#126283 - 2004-09-08 03:27 PM
Re: local printer prob.
|
pong
Fresh Scripter
Registered: 2004-08-27
Posts: 14
Loc: Zeist, The Netherlands
|
Here it is, i used an udf from http://www.gwspikval.com/jooel/UDF/ by Radimus and changed it.
Lpt1Printer() Function Lpt1Printer() Dim $index,$inst_printers,$PrinterPorts,$port_type
$index=0 $PrinterPorts="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts" :loopprinters $inst_printers=EnumValue($PrinterPorts,$index) If @error=0 ? "$inst_printers" $port_type=ReadValue("$PrinterPorts","$inst_printers") ? "$port_type" If InStr("$port_type","LPT1") ? "lpt1 found" $=SetDefaultPrinter("$inst_printers") $FoundLpt1 = 1 Return EndIf Else Return EndIf $index=$index+1 GoTo loopprinters
EndFunction
If $FoundLpt1 = 1 ? "Found Lpt1, dont install network printer" Else ? "No Lpt1, install network printer" EndIf
It will check the registry for the printers and their ports, then checks if any port matches "lpt1". If so, it will set the lpt1 printer default, else it does nothing. Script works fine.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 2145 anonymous users online.
|
|
|