;=================== Printer Settings =================================
SELECT
CASE @LSERVER = "\\MYHOSTCV"
$_Pr = "\\MYHOSTCV\Barney"
PrintMaker($_pr)
$_Pr = "\\MYHOSTCV\MFP"
PrintMaker($_pr)
$_Pr = "\\MYHOSTCV\MFP_Reception"
PrintMaker($_pr)
$_Pr = "\\MYHOSTCV\HPColour"
PrintMaker($_pr)
CASE @LSERVER = "\\MYHOSTED"
$_Pr = "\\MYHOSTED\Basil_Print"
PrintMaker($_pr)
$_Pr = "\\MYHOSTED\HP_Colour"
PrintMaker($_pr)
$_Pr = "\\MYHOSTED\HP_Colour_Duplex"
PrintMaker($_pr)
ENDSELECT
;============================ FUNCTION PriMapState ========================
;FUNCTION PriMapState
;
;AUTHOR Lonkero (Jooel.Nieminen@gwspikval.com)
;
;ACTION Checks for existent networkprinter connection
;
;VERSION 1.1.1
;
;CHANGES 1.1.1 - 01. november 2003
; Fixed buggie descriped in:
; http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=008079
; 1.1 - 02. July 2002
; added support for win9x
; 1.0 - 01. July 2002
; initial release
;
;SYNTAX PriMapState(PRINTER)
;
;PARAMETERS PRINTER
; to be checked Printer's name
;
;RETURNS 1 if printer connected
; 2 if printer is default
; nothing if not connected
;
;REMARKS code for w9x adapted from BrianTX
;
;DEPENDENCIES none
;
;EXAMPLE
; if not PriMapState('\\server\printer1')
; "printer1 not connected!"
; endif
;
;CODE
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
endfunction
;============================ FUNCTION PrintMaker ============================
FUNCTION PrintMaker($_pr)
IF PriMapState($_pr) = 0
$null = ADDPRINTERCONNECTION($_Pr)
ENDIF
ENDFUNCTION