This is a script I am phasing out as I have no need for it nowadays. I figure, I may as well post it up for anyone that may find this handy. It will grab a file within same directory as EXE named IPS.txt which contains a delimited list of names followed by ip of the particular printer. Currently it is set to use a driver for Xerox (not included), you will have to adjust to your needs.

The /m “Xerox WorkCentre 4260 PCL6” part in addition to the .inf file will have to be adjusted. This value comes from within the INF (open in text editor and look to see what the exact driver name you should be calling is).

Example of IPS.txt

172.22.1.145|Xerox Main Office
172.22.41.146|Multi-Purpose Room

 

 

AutoIt Code

#RequireAdmin

$file = FileOpen("IPS.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file IP.txt containing Xerox IP's")
Exit
EndIf

$count = 1
While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
$printer = StringSplit($line, "|")
RunWait('cscript "' & @ScriptDir & '\Drivers\prnport.vbs" -a -r IP_' & $printer[1] & ' -h ' & $printer[1] & ' -o raw -n 9100')
RunWait('RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b "' & $printer[2] & '" /f "' & @ScriptDir & '\Drivers\x2WCASX.inf" /r "IP_' & $printer[1] & '" /m "Xerox WorkCentre 4260 PCL6"')
$count = $count +1
Wend

FileClose($file)

MsgBox(1, "Complete", "Xerox printer installation completed")

1 Comments