input from Chris Page (fourth/last part)

code:

Function GetPrinters
; Builds a list of printers referred to in Stations.ini
DIM $List, $I, $Prn, $PrnList
$List = ReadProfileString("Y:\Stations.ini", "Printers", "")
$WksPrnArray = Split($List,CHR(10))
For $I = 0 To UBound($WksPrnArray) - 1 ;there is a trailing CHR(10), hence a null element
$Prn = ReadProfileString("Y:\Stations.ini", "Printers", $WksPrnArray[$I])
If Len($Prn) > 4 ; \\s\p is minimum valid form
SELECT
CASE $Prn = "\\NameOfComputerWithPrinterAttached\ShareName"; ignore this example line
CASE $PrnList = "" ; first one
$PrnList = $PrnList + $Prn
CASE Instr($PrnList, $Prn) = 0 ; not found before
$PrnList = $PrnList + "," + $Prn
ENDSELECT
endif
Next
$Printers = Split($PrnList, ",")
EndFunction

Function Example_INI_files

;Example Stations.ini
;--------------------

[Kixtart]
Version=6.44
PDC=\\Wig
BDC=\\Wig
CDServer=\\Wig
KIX Version=4.00
Debug=1
;Pause=Always

[Additional Printers]
Printer1-5=\\NameOfComputerWithPrinterAttached\ShareName
Printer1=\\Wig\Colour

[Printers]
ComputerName=\\NameOfComputerWithPrinterAttached\ShareName
WIG=\\wig\hplaser
DFFMF60J=\\wig\hplaser
D1FMF60J=\\wig\hplaser
ED-BX5640J=Local
DIFMF60J=NONE

;Example Station.ini for ED-BX5640J
;----------------------------------
[Additional Printers]
Printer1-5=\\NameOfComputerWithPrinterAttached\ShareName
Printer1=\\Wig\hplaser

EndFunction

Sorry if I've missed anything vital.

Chris

[ 16 November 2001: Message edited by: MCA ]

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA