IF Left(@WKSTA, 5) = "55PUL"
GOTO Pulaski
Else
GOTO Mercy
ENDIF
:Mercy
; a VARTYPE of 8 means that the value of $printer is a string, try to map the printer
IF VARTYPE($printer) = 8
IF AddPrinterConnection($printserver + $printer) = 0
WRITELINE(5, "Mapped Default Printer to " + $printserver + $printer + @CRLF)
; The SetDefaultPrinter command relies on the printer NAME not the printer SHARE
$nul = SetDefaultPrinter($printserver + $printer)
ELSE
$nul = WRITELINE(5, "An error occurred mapping the Default Printer to " + $printserver + $printer +@CRLF)
ENDIF
ENDIF
; Read the next 4 lines of the file and concatenate them. Check to see if they are empty.
FOR $count = 1 TO 4
$nextline = READLINE(1)
$printer = SUBSTR($nextline,12)
IF VARTYPE($printer) = 8
IF AddPrinterConnection($printserver + $printer) = 0
$nul = WRITELINE(5,"Created a Printer Connection to " + $printserver + $printer + @CRLF)
ELSE
$nul = WRITELINE(5,"An error occurred creating a printer connection to " + $printserver + $printer + @CRLF)
ENDIF
ENDIF
GOTO Setup