Dim $Printers, $Printer
Dim $Drives, $Drive
$Printers = Split(''
+ '\\OLD01\FIN' + '|'
+ '\\OLD01\MEM' + '|'
+ '\\OLD01\LJC2550PS3' + '|'
+ '\\OLD01\LJC3800PS' + '|'
+ '\\OLD01\LJ4250NPS' + '|'
+ '\\OLD01\LJ4250TN' + '|'
+ '\\OLD01\LJ4250TN2' + '|'
+ '\\OLD01\LJ8100PCL6' + '|'
+ '\\OLD01\LJ8100PS' + '|'
+ '\\OLD01\LJ4300PCL6' + '|'
+ '\\OLD01\MCROPLXF24' + '|'
+ '\\OLD01\OJ7310' , '|')
;Installs printers for everybody.
If @wksta <> 'OLD01'
; Installing Printers...
If InGroup("tech")
?"Mailroom printer install"
If PriMapState('\\OLD01\XWC120PS') = ''
$RC = AddPrinterConnection('\\OLD01\XWC120PS')
EndIf
EndIf
For Each $Printer in $Printers
If PriMapState($Printer) = ''
$RC = AddPrinterConnection($Printer)
EndIf
; Do not forget to add the PriMapState UDF
function PriMapState($_Pri)
if @inwin=1
if len(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices",$_Pri))
if split(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0]=$_Pri
$PriMapState=2
else
$PriMapState=1
endif
endif
else
dim $_Root,$_C,$_C2 $_Root="HKLM\System\CurrentControlSet\control\Print\Printers"
for $_C=0 to 259
$_C2=enumkey($_Root,$_C)
If instr(READVALUE($_Root+"\"+$_C2,"Port"),$_Pri)
If instr(READPROFILESTRING("%windir%\win.ini","windows","device"),$_Pri)
$PriMapState = 2
Else
$PriMapState = 1
Endif
Endif
if $_C2=259 $_C=$_C2 endif
next
endif
[code]