General information
Category:
Coding, syntax & commands
Ok have just found the semi-solution to this - I can now seperate the Network from the Local Printers and display them accordingly. HOWEVER I still need to find the Share names of these Printers.
This is my code on how I got the printers & displayed them:
LOCAL lcpamount, lcprntname, ncount, lcprn
lcprntname = ""
lcPart1 = ""
lcPart2 = ""
lcNetwork = ""
lcLocal = ""
lcnetc = ""
lclocalc = ""
nline = 1
APRINTERS(aprnt) &&& Get list of Printers
lcpamount = ALEN(aprnt) &&& Find how many items in Array
FOR ncount = 1 TO lcpamount
lcprn = ALLTRIM(aprnt(ncount))
IF nline = 1
lcPart1 = ALLTRIM(lcprntname) +" " +ALLTRIM(lcprn)
nline = 2 &&& The next information will be Part 2 of the String
ELSE
IF LEFT(lcprn,1) = "\"
lcNetwork = lcPart1 + " Attached to " + lcprn +CHR(13) +CHR(10)
&&& Create a line feed & Carrage return
lcNetc = lcNetc + lcNetwork
&&& String for the Network information
ELSE
lcLocal = lcPart1 + " Attached to Port " + lcprn +CHR(13) +CHR(10)
&&& Create a line feed & Carrage return
lcLocalc = lcLocalc + lcLocal
&&& String for the Local information
ENDIF
nline = 1 &&& Go back to get part one of the string
ENDIF
ENDFOR
THISFORM.pageframe1.page2.edtPDIR.VALUE=ALLTRIM(lcLocalc) && Populate all Local Printers
THISFORM.pageframe1.page2.edtPNET.VALUE=ALLTRIM(lcNetc) && Populate all Network Printers
If anyone could help with finding the sharenames of the printers it would help allot.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only