input from Chris Page (third part)
Function SelectPrinter
; Offers user a selection of printers used on the network
; Allows to choose one or open Stations.ini for more complex editing
DIM $I, $s, $nul
$CurrentPrn = ReadProfileString("Y:\Stations.ini", "Printers", @WKSTA)
If $CurrentPrn = "" $CurrentPrn = "None" endif
GetPrinters ;? $PrnList
? " Workstation: " @WKSTA
? "Current Printer: " $CurrentPrn
?
? "Available Printers"
? "=================="
? "0 - Don't change."
$I = 1
For Each $Printer in $Printers
? "" + $I + " - " $Printer
$I = $I + 1
Next
? ? "Select the printer for this computer: "
DO GetS $s UNTIL Val($s) < Val($I)
SELECT
CASE Val($s) = 0 ; No Change
? "Printer not changed, @WKSTA=$CurrentPrn"
CASE Val($s) < 0 ; Prompt to enter
Run "Notepad.exe Y:\Stations.ini"
CASE 1 ; All other cases
$nul = WriteProfileString("Y:\Stations.ini", "Printers", @WKSTA,$Printers[Val($s) - 1])
? "Printer changed to " + @WKSTA + "=" + $Printers[VAL($s) - 1]
ENDSELECT
EndFunction
[/code]