Page 1 of 1 1
Topic Options
#51706 - 2000-10-07 02:37 AM KIXTART-TOOL: calculates default printer & other printers
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We have create a piece of code, which calculates all specified printers
on your workstations. Independent of network or local printer type.
It creates historical and dynamic lists. The information of default prin-
ter is also with to the eventvwr log by windows NT systems.

Program: printers.kix
Site: http://home.wanadoo.nl/scripting


code:

IF setconsole("hide")
ENDIF
;
; NT/95 logging - Kixtart 3.62
;
; (c) scripting@wanadoo.nl - 2000
;
; vs 1.00 - program (printers)
;
; 1.00 (20001010) original version
;
$prgrm_version="1.00"
;
; --------------------------------------------------------------------------
; - Site Specific Codes
; -
; - 1. "$file" log printer information to specified file. it is the prefix value.
; - extension are:
; - - .lst (= historical list with a total list of all configured printers)
; - - .usr (= dynamic list by username)
; - - .def (= dynamic list by printer & username)
; - _debug.txt (= debug information)
; - advise: use a hidden directory on server with read + write access.

; - 2. "$debug_mode". usefull for kixtar programmers.
; - 3. "$debug_file". log printers debug information to specified file.
; --------------------------------------------------------------------------
;
$file="c:\printers"
;
$debug_mode="no" ; - no/yes - for additional information about checking registry keys -
$debug_file=$file+"_debug.txt"
;
; --------------------------------------------------------------------------
;
$cr=CHR(10)
$lf=CHR(13)
$eol=$cr
;
IF (@inwin = 1)
$NT_mode="yes"
ELSE
$NT_mode="no"
ENDIF
IF (len(@ipaddress0) = 0)
$offline_mode="yes"
ELSE
$offline_mode="no"
ENDIF
;
break off
flushkb
;
IF ($debug_mode = "yes")
IF (RedirectOutput("c:\printers_debug.txt",1) = 0)
ENDIF
ENDIF

; --------------------------------------------------------------------------
; - -
; --------------------------------------------------------------------------

:script_collect_pc_info

$x="" ; - it will contains all kind of information about workstation and server -
; - f.e. 00127_000505_23:23:23 DOMAIN=(NT - vs 1.01 L DOMAIN \\SPLxxxxx) 171.077.077.100 00A02ABABEEE mca SPLzzzzz ('MCA')
$domain=""
$ldomain=""
IF ($NT_mode = "yes")
$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
IF (ExistKey($ikey) = 0)
$domain=ReadValue($ikey, "DefaultDomainName")
ENDIF
$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
IF (ExistKey($ikey) = 0)
$ldomain=ReadValue($ikey, "CachePrimaryDomain")
ENDIF
ELSE
$ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP2\NetworkProvider"
IF (ExistKey($ikey) = 0)
$domain=ReadValue($ikey, "AuthenticatingAgent")
ENDIF
$ikey="HKEY_LOCAL_MACHINE\Security\Provider"
IF (ExistKey($ikey) = 0)
$ldomain=ReadValue($ikey, "Container")
ENDIF
ENDIF
IF (len($domain) = 0)
IF (len(@ldomain) <> 0)
$domain=@ldomain
ELSE
$domain=@domain
ENDIF
IF (len($domain) = 0)
$domain="~domain" ; - unknown @domain/@ldomain value -
ENDIF
ENDIF
IF (len($ldomain) = 0)
$ldomain=$domain
ENDIF
;
IF ($NT_mode = "yes")
$time_start=@time
$log_info="Kixtart-VIC "+$prgrm_version+" script started"
$log_info=$log_info+" for '"+LCASE(@userid)+"'"
$log_info=$log_info+" ("+$time_start+" - '"+@ipaddress0+"')"
IF logevent(0, 1, $log_info, "", "Kixtart PRT @kix")
ENDIF
ENDIF

; --------------------------------------------------------------------------
; - special variables settings -
; --------------------------------------------------------------------------

$section=substr(@date,3,2)
IF (@ydayno < 10)
$section=$section+"00"+@ydayno
ELSE
IF (@ydayno < 100)
$section=$section+"0"+@ydayno
ELSE
$section=$section+@ydayno
ENDIF
ENDIF
$key=$section+"_"
$key=$key+substr(@date,3,2)+substr(@date,6,2)+substr(@date,9,2)
$key=$key+"_"
$key=$key+@time
$key=$key+" "+$domain

; - calculation of LSERVER variable -
IF (len(@ipaddress0) = 0)
$offline_mode="yes"
IF ($NT_mode = "yes")
$x=$x+"(NT - vs "+$prgrm_version+" - off-line )"
ELSE
$x=$x+"(95 - vs "+$prgrm_version+" - off-line )"
ENDIF
ELSE
$offline_mode="no"
IF (len(@lserver) = 0)
$lserver="~lserver "
ELSE
$lserver=@lserver ; - \\spln99999 -
ENDIF
IF (LCASE($domain) = LCASE($ldomain))
IF ($NT_mode = "yes")
$x=$x+"(NT - vs "+$prgrm_version+" L $domain $lserver)"
ELSE
$x=$x+"(95 - vs "+$prgrm_version+" L $domain $lserver)"
ENDIF
ELSE
IF ($NT_mode = "yes")
$x=$x+"(NT - vs "+$prgrm_version+" - $domain $lserver)"
ELSE
$x=$x+"(95 - vs "+$prgrm_version+" - $domain $lserver)"
ENDIF
ENDIF
ENDIF
; - calculation of ip/mac-address value -
IF (len(@ipaddress0) = 15)
$i=1
$ip_old=@ipaddress0
$ip_new=""
DO
IF (substr($ip_old,$i,1) <> " ")
$ip_new=$ip_new+substr($ip_old,$i,1)
ELSE
$ip_new=$ip_new+"0"
ENDIF
$i=$i+1
UNTIL ($i > 15)
ELSE
$ip_new="xxx.xxx.xxx.xxx"
ENDIF
$x=$x+" "+$ip_new
;
IF (len(@address) = 0)
$address="xxxxxxxxxxxx"
ELSE
$address=@address
ENDIF
$x=$x+" "+$address
; - calculation of USER variable -
$user=""
IF ($NT_mode = "yes")
$ikey="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
IF (ExistKey($ikey) = 0)
$user=ReadValue($ikey, "DefaultUserName")
ENDIF
ELSE
$ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\control"
IF (ExistKey($ikey) = 0)
$user=ReadValue($ikey, "Current User")
ENDIF
ENDIF
IF (len($user) = 0)
$user=@userid
IF (len($user) = 0)
$user="~user"
ENDIF
ENDIF
$x=$x+" "+$user
; - calculation of WORKSTATION value -
IF (len(@wksta) = 0)
$x=$x+" ~wksta"
ELSE
$x=$x+" "+@wksta
ENDIF
IF (len(@fullname) = 0)
IF (len(@comment) = 0)
$x=$x+" ('~fullname')"
ELSE
$x=$x+" ('~fullname'+'"+@comment+"')"
ENDIF
ELSE
IF (len(@comment) = 0)
$x=$x+" ('@fullname')"
ELSE
$x=$x+" ('"+@fullname+"'+'"+@comment+"')"
ENDIF
ENDIF

$tmp=$x

IF ($debug_mode = "yes")
; cls
IF ($NT_mode = "yes")
IF (len(@ipaddress0) = 0)
? "Kixtar "+@kix+" - NT debug mode (vs "+$prgrm_version+")"+" "+@time+" (off-line)"
ELSE
? "Kixtar "+@kix+" - NT debug mode (vs "+$prgrm_version+")"+" "+@time+" (on-line)"
ENDIF
ELSE
IF (len(@ipaddress0) = 0)
? "Kixtar "+@kix+" - 95 debug mode (vs "+$prgrm_version+")"+" "+@time+" (off-line)"
ELSE
? "Kixtar "+@kix+" - 95 debug mode (vs "+$prgrm_version+")"+" "+@time+" (on-line)"
ENDIF
ENDIF
?
? "file "+$file+".???"
? "section "+$section
? "key "+$key
IF (len(@fullname) = 0)
? "user "+$user
ELSE
IF (len(@comment) = 0)
? "user "+$user+" ('"+@fullname+"')"
ELSE
? "user "+$user+" ('"+@fullname+"'+'"+@comment+"')"
ENDIF
ENDIF
?
? "workstation "+@wksta+" ("+LCASE(@lanroot)+") C="+GetDiskSpace("c:\")+" KBytes"
? "domain "+@domain
? "ldomain "+@ldomain
? " -> = "+$domain
? " "+$ldomain+" (L)"
? "ip_adress "+$ip_new+" "+$address
?
? "debug_mode "+$debug_mode
? "offline_mode "+$offline_mode
?
ENDIF

; --------------------------------------------------------------------------
; - -
; --------------------------------------------------------------------------

; - :script_printers1

$execute_mode="yes"
IF ($execute_mode = "yes")
$x=$tmp

$ikey="HKEY_CURRENT_USER\Printers\Connections"
IF (existkey($ikey) = 0)
$first=""
$x=$x+" HKCU.printers.connections=("
$index=0
DO
$icode=ENUMKEY($ikey, $index)
IF (len($icode) <> 0)
$x=$x+$first+"'"+substr($icode, 3, len($icode) - 2)+"'"
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

; ----- printers mapping (part 2) print.printers - NT/95 -----

$ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers"
IF (existkey($ikey) = 0)
$first=""
$x=$x+" HKLM.print.printers[local_printer]=("
$index=0
DO
$icode=ENUMKEY($ikey, $index)
IF (len($icode) <> 0)
$code="["
$code=$code+"'"+$icode+"'"
$code=$code+" name='" +ReadValue($ikey+"\"+$icode, "Name")+"'"
$code=$code+" share_name='" +ReadValue($ikey+"\"+$icode, "Share Name")+"'"
$code=$code+" port='" +ReadValue($ikey+"\"+$icode, "Port")+"'"
$code=$code+" printer_driver='" +ReadValue($ikey+"\"+$icode, "Printer Driver")+"'"
; $code=$code+" spool_directory='"+ReadValue($ikey+"\"+$icode, "Spool Directory")+"'"
$code=$code+" default_spool_directory='"+ReadValue($ikey, "DefaultSpoolDirectory")+"'"
$code=$code+"]"
$x=$x+$first+$code
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

; ----- printers mapping (part 3a) devices - NT -----

$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices"
IF (existkey($ikey) = 0)
$first=""
$index=0
$x=$x+" HKCU.CurrentVersion.Devices[NT]=("
DO
$icode=ENUMVALUE($ikey, $index)
IF (len($icode) <> 0)
$x=$x+$first+"'"+$icode+"="+ReadValue($ikey, $icode)+"'"
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

; ----- printers mapping (part 3b-1) PrinterPorts - NT -----

$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts"
IF (existkey($ikey) = 0)
$first=""
$index=0
$x=$x+" HKCU.CurrentVersion.PrinterPorts[NT]=("
DO
$icode=ENUMVALUE($ikey, $index)
IF (len($icode) <> 0)
$x=$x+$first+"'"+$icode+"="+ReadValue($ikey, $icode)+"'"
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

; ----- printers mapping (part 3b-2) Printers + PrnPortsMRU - 95 -----

$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Printers"
IF (existkey($ikey) = 0)
$first=""
$index=0
$x=$x+" HKCU.CurrentVersion.Printers[95]=("
DO
$icode=ENUMVALUE($ikey, $index)
IF (len($icode) <> 0)
$x=$x+$first+"'"+$icode+"'"
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU"
IF (existkey($ikey) = 0)
$first=""
$index=0
$x=$x+" HKCU.CurrentVersion.PrnPortsMRU[95]=("
DO
$icode=ENUMVALUE($ikey, $index)
IF (len($icode) <> 0)
$x=$x+$first+"'"+$icode+"="+ReadValue($ikey, $icode)+"'"
$first=","
ENDIF
$index=$index+1
UNTIL (len($icode) = 0)
$x=$x+")"
ENDIF

; ----- printer mapping information (part 4a) windows - NT -----

$ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows"
IF (existkey($ikey) = 0) ; - NT -
$default_printer=ReadValue($ikey, "device")
$default_port=""
IF (INSTR(LCASE($default_printer),",lpt") <> 0)
$default_port=UCASE(substr($default_printer,INSTR(LCASE($default_printer),",lpt")+1,5))
ENDIF
;
IF (len($default_printer) = 0)
$default_printer="NONE"
ENDIF
IF (len($default_port) = 0)
$default_port="NONE"
ENDIF
;
$x=$x+" HKCU.CurrentVersion.Windows[NT:default.printer]=("
IF (len($default_port) <> 0) AND ($default_port <> "NONE")
$x=$x+$default_port+" " ; - LPT type -
ENDIF
IF (len($default_printer) <> 0)
$x=$x+"'"+$default_printer+"'"
ENDIF
$x=$x+")"
ELSE
IF ($NT_mode = "yes")
$x=$x+" HKCU.CurrentVersion.Windows[NT:default.printer]=('NONE')"
ENDIF
ENDIF

; ----- printer mapping information (part 4b) windows - 95 -----

; $ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\IDConfigDB:CurrentConfig" -> "0001"
$ikey="HKEY_LOCAL_MACHINE\Config\0001\System\CurrentControlSet\Control\Print\Printers"
IF (existkey($ikey) = 0) ; - 95 -
$default_printer=ReadValue($ikey, "default")
$default_port=""
$ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers\"+$default_printer
IF (existkey($ikey) = 0)
$default_port=ReadValue($ikey, "Port")
ENDIF
;
IF (len($default_printer) = 0)
$default_printer="NONE"
ENDIF
IF (len($default_port) = 0)
$default_port="NONE"
ENDIF
;
$x=$x+" HKLM.print.printers[95:default.printer]=("
IF (len($default_port) <> 0)
$x=$x+$default_port+" "
ENDIF
IF (len($default_printer) <> 0)
$x=$x+"'"+$default_printer+"'"
ENDIF
$x=$x+")"
ELSE
IF ($NT_mode <> "yes")
$x=$x+" HKLM.print.printers[95:default.printer]=('NONE')"
ENDIF
ENDIF

$file1=$file+".lst"
IF ($debug_mode = "yes")
?
? " file = "+UCASE($file1)
? " key = "+$key
? " x = "+$x
?
ENDIF
IF (open(9, $file1, 5) = 0)
IF writeline(9, $key+"="+$x+$eol)
ENDIF
ENDIF
IF close(9)
ENDIF
ELSE
IF ($debug_mode = "yes")
?
? " -SKIP- = HKCU.printers.connections + HKLM.print.printers[local_printer] + HKCU.CurrentVersion.Devices[NT] + HKCU.CurrentVersion.PrinterPorts[NT] + HKCU.CurrentVersion.Windows:Device[default.printer]"
?
ENDIF
ENDIF

; --------------------------------------------------------------------------
; - -
; --------------------------------------------------------------------------

; - :script_printers2 ; - default printer - NT/95 -

; - $default_printer (previously calculated) -
; - $default_port (previously calculated) -
;
IF ($NT_mode = "yes")
IF (len($default_port) <> 0) AND (INSTR(LCASE($default_port),"lpt") = 0)
$default_port="" ; - LPT type -
ENDIF
ENDIF
;
$defprt=""
IF (len($default_port) <> 0)
IF (INSTR(LCASE($default_port),"lpt") = 0)
$defprt=$defprt+"'"+$default_port+"'"
ELSE
$defprt=$defprt+UCASE($default_port)
ENDIF
$defprt=$defprt+" "
ENDIF
IF (len($default_printer) <> 0)
$defprt=$defprt+"'"
IF (INSTR($default_printer,",") <> 0)
$defprt=$defprt+substr($default_printer,1,INSTR($default_printer,',')-1)
ELSE
$defprt=$defprt+$default_printer
ENDIF
$defprt=$defprt+"'"
ELSE
$defprt=$defprt+"'NONE'"
ENDIF

; ----- additional logfiles - (part 1: Printers.USR) - NT/95 (default printer) -----

; - $default_printer (previously calculated) -
; - $default_port (previously calculated) -
; - $defprt (previously calculated) -
;
$file_y=$file+".usr"
IF ($NT_mode = "yes")
$section_x=$domain+"_NT"
ELSE
$section_x=$domain+"_95"
ENDIF
$key_x=substr(LCASE($user) +" ",1,15)+" "
$key_x=$key_x+$section_x
$xxx=""
$xxx=$xxx+substr($key,1,22)
$xxx=$xxx+substr(LCASE(@wksta)+" ",1,15)+" "
$xxx=$xxx+substr($defprt+" ",1,55)+" "
$xxx=$xxx+$tmp
;
IF ($debug_mode = "yes")
?
? " file_y = "+$file_y
? " section_x = "+$section_x
? " key_x = "+$key_x
? " xxx = "+$xxx
? " default_prt = "+$default_printer
? " port "+$default_port
? " defprt = "+$defprt
?
ENDIF
IF writeprofilestring($file_y, $section_x, $key_x, $xxx)
ENDIF

; ----- additional logfiles - (part 2: Printers.DEF) - NT/95 (default printer) -----

; - $default_printer (previously calculated) -
; - $default_port (previously calculated) -
;
$file_y=$file+".def"
IF ($NT_mode = "yes")
$section_x=$domain+"_NT"
ELSE
$section_x=$domain+"_95"
ENDIF
$key_x=substr($defprt+" ",1,55)+" "
$key_x=$key_x+substr(LCASE($user) +" ",1,15)+" "
$key_x=$key_x+$section_x
$xxx=""
$xxx=$xxx+substr($key,1,22)
$xxx=$xxx+substr(LCASE(@wksta)+" ",1,15)+" "
$xxx=$xxx+$tmp
;
IF ($debug_mode = "yes")
?
? " file_y = "+$file_y
? " section_x = "+$section_x
? " key_x = "+$key_x
? " xxx = "+$xxx
? " default_prt = "+$default_printer
? " port "+$default_port
? " defprt = "+$defprt
?
ENDIF
IF writeprofilestring($file_y, $section_x, $key_x, $xxx)
ENDIF

; --------------------------------------------------------------------------
; - -
; --------------------------------------------------------------------------

IF (RedirectOutput("con",1) = 0)
ENDIF
;
IF ($debug_mode = "yes")
IF ($NT_mode = "yes")
? "Kixtar "+@kix+" - NT debug mode (vs "+$prgrm_version+")"+" "+@time
ELSE
? "Kixtar "+@kix+" - 95 debug mode (vs "+$prgrm_version+")"+" "+@time
ENDIF
?
? " def.printer = "+$default_printer
? " port = "+$default_port
? " defprt = "+$defprt
?
ENDIF

:end_script

IF ($NT_mode = "yes")
$time_stop=@time
$log_info="Kixtart-VIC "+$prgrm_version+" script completed successfully"
$log_info=$log_info+" for '"+LCASE($user)+"' "+UCASE($domain)
$log_info=$log_info+" ("+$time_start+" - "+$time_stop+" - '"+$ip_new+"')"
IF (len(@fullname) > 0)
$log_info=$log_info+" '"+LCASE(@fullname)+"'"
ENDIF
$log_info=$log_info+" '"+LCASE($default_printer)+"'"
$log_info=$log_info+" '"+LCASE($default_port)+"'"
$log_info=$log_info+" '"+LCASE($defprt)+"'"
IF logevent(0, 1, $log_info, "", "Kixtart PRT @kix"+"c")
ENDIF
ENDIF
;
break on
flushkb
beep


Output printers.lst (= historical list with a total list of all configured printers)

windows 9x

code:

00281_001007_01:32:42 ~domain=(95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname') HKLM.print.printers[local_printer]=(['HP LaserJet 4L' name='HP LaserJet 4L' share_name='' port='LPT1:' printer_driver='HP LaserJet 4L' default_spool_directory=''],['Acrobat Distiller' name='Acrobat Distiller' share_name='' port='C:\Program Files\Adobe\Acrobat 4.0\PDF Output\*.pdf' printer_driver='AdobePS Acrobat Distiller' default_spool_directory=''],['Acrobat PDFWriter' name='Acrobat PDFWriter' share_name='' port='LPT1:' printer_driver='Acrobat PDFWriter' default_spool_directory='']) HKCU.CurrentVersion.Printers[95]=('HP LaserJet 4L') HKCU.CurrentVersion.PrnPortsMRU[95]=() HKLM.print.printers[95:default.printer]=(LPT1: 'HP LaserJet 4L')

windows NT

code:

00281_001007_01:47:28 WORKSTATION=(NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain') HKCU.printers.connections=() HKLM.print.printers[local_printer]=(['HP LaserJet 4L' name='HP LaserJet 4L' share_name='' port='LPT1:' printer_driver='HP LaserJet 4L' default_spool_directory='C:\WINNT\System32\spool\PRINTERS']) HKCU.CurrentVersion.Devices[NT]=('HP LaserJet 4L=winspool,LPT1:') HKCU.CurrentVersion.PrinterPorts[NT]=('HP LaserJet 4L=winspool,LPT1:,15,45') HKCU.CurrentVersion.Windows[NT:default.printer]=(LPT1: 'HP LaserJet 4L,winspool,LPT1:')

Output printers.usr (= dynamic list by username)

code:

[~domain_95]
username ~domain_95=00281_001007_01:32:42 computername LPT1: 'HP LaserJet 4L' (95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname')
[WORKSTATION_NT]
administrator WORKSTATION_NT=00281_001007_01:47:28 workstation LPT1: 'HP LaserJet 4L' (NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain')

Output printers.def (= dynamic list by printer & username)

code:

[~domain_95]
LPT1: 'HP LaserJet 4L' username ~domain_95=00281_001007_01:32:42 computername (95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname')
[WORKSTATION_NT]
LPT1: 'HP LaserJet 4L' administrator WORKSTATION_NT=00281_001007_01:47:28 workstation (NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain')

Output of debug mode (result of '$debug_mode="yes"'):

windows 9x

code:

Kixtar 3.62 - 95 debug mode (vs 1.00) 01:32:43 (off-line)

file c:\printers.???
section 00281
key 00281_001007_01:32:42 ~domain
user username

workstation COMPUTERNAME (c:\windows\system) C=772480 KBytes
domain
ldomain
-> = ~domain
~domain (L)
ip_adress xxx.xxx.xxx.xxx 000000000000

debug_mode yes
offline_mode yes


file = C:\PRINTERS.LST
key = 00281_001007_01:32:42 ~domain
x = (95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname') HKLM.print.printers[local_printer]=(['HP LaserJet 4L' name='HP LaserJet 4L' share_name='' port='LPT1:' printer_driver='HP LaserJet 4L' default_spool_directory=''],['Acrobat Distiller' name='Acrobat Distiller' share_name='' port='C:\Program Files\Adobe\Acrobat 4.0\PDF Output\*.pdf' printer_driver='AdobePS Acrobat Distiller' default_spool_directory=''],['Acrobat PDFWriter' name='Acrobat PDFWriter' share_name='' port='LPT1:' printer_driver='Acrobat PDFWriter' default_spool_directory='']) HKCU.CurrentVersion.Printers[95]=('HP LaserJet 4L') HKCU.CurrentVersion.PrnPortsMRU[95]=() HKLM.print.printers[95:default.printer]=(LPT1: 'HP LaserJet 4L')


file_y = c:\printers.usr
section_x = ~domain_95
key_x = username ~domain_95
xxx = 00281_001007_01:32:42 computername LPT1: 'HP LaserJet 4L' (95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname')
default_prt = HP LaserJet 4L
port LPT1:
defprt = LPT1: 'HP LaserJet 4L'


file_y = c:\printers.def
section_x = ~domain_95
key_x = LPT1: 'HP LaserJet 4L' username ~domain_95
xxx = 00281_001007_01:32:42 computername (95 - vs 1.00 - off-line ) xxx.xxx.xxx.xxx 000000000000 username COMPUTERNAME ('~fullname')
default_prt = HP LaserJet 4L
port LPT1:
defprt = LPT1: 'HP LaserJet 4L'


code:

Kixtar 3.62 - NT debug mode (vs 1.00) 01:47:28 (on-line)

file c:\printers.???
section 00281
key 00281_001007_01:47:28 WORKSTATION
user administrator ('Windows NT Administator'+'Built-in account for administering the computer/domain')

workstation WORKSTATION (c:\winnt\system32) C=30784 KBytes
domain WORKGROUP
ldomain WORKSTATION
-> = WORKSTATION
WORKSTATION (L)
ip_adress 127.000.000.001 000000000000

debug_mode yes
offline_mode no


file = C:\PRINTERS.LST
key = 00281_001007_01:47:28 WORKSTATION
x = (NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain') HKCU.printers.connections=() HKLM.print.printers[local_printer]=(['HP LaserJet 4L' name='HP LaserJet 4L' share_name='' port='LPT1:' printer_driver='HP LaserJet 4L' default_spool_directory='C:\WINNT\System32\spool\PRINTERS']) HKCU.CurrentVersion.Devices[NT]=('HP LaserJet 4L=winspool,LPT1:') HKCU.CurrentVersion.PrinterPorts[NT]=('HP LaserJet 4L=winspool,LPT1:,15,45') HKCU.CurrentVersion.Windows[NT:default.printer]=(LPT1: 'HP LaserJet 4L,winspool,LPT1:')


file_y = c:\printers.usr
section_x = WORKSTATION_NT
key_x = administrator WORKSTATION_NT
xxx = 00281_001007_01:47:28 workstation LPT1: 'HP LaserJet 4L' (NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain')
default_prt = HP LaserJet 4L,winspool,LPT1:
port LPT1:
defprt = LPT1: 'HP LaserJet 4L'


file_y = c:\printers.def
section_x = WORKSTATION_NT
key_x = LPT1: 'HP LaserJet 4L' administrator WORKSTATION_NT
xxx = 00281_001007_01:47:28 workstation (NT - vs 1.00 L WORKSTATION \\WORKSTATION) 127.000.000.001 000000000000 administrator WORKSTATION ('Windows NT Administator'+'Built-in account for administering the computer/domain')
default_prt = HP LaserJet 4L,winspool,LPT1:
port LPT1:
defprt = LPT1: 'HP LaserJet 4L'


Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#51707 - 2003-07-08 02:45 PM Re: KIXTART-TOOL: calculates default printer & other printers
Mikecl Offline
Fresh Scripter

Registered: 2001-12-08
Posts: 18
Hi All,

I downloaded the Printer.kix (Vs 2.05) script but when run the script displays the error failed to find/open script. The earlier version uses a $file variable to display where the output file should be, where does this output the file data to?

Cheers Mike
[Confused]

Top
#51708 - 2003-07-08 02:55 PM Re: KIXTART-TOOL: calculates default printer & other printers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not sure what is your problem.
at least this one where you replied it simply says $file="c:\printers"
_________________________
!

download KiXnet

Top
#51709 - 2003-07-09 09:38 AM Re: KIXTART-TOOL: calculates default printer & other printers
Mikecl Offline
Fresh Scripter

Registered: 2001-12-08
Posts: 18
Hi,

The problem is that the script fails to run because of the error message the latest script does seems to point to a temporary directory

Thanks Mike
================================================
; $tmp_directory=ExpandEnvironmentVars("%tmp%")
; IF (substr($tmp_directory,len($tmp_directory),1) <> "\")
; $tmp_directory=$tmp_directory+"\"
; ENDIF

; ---------------------------------------------------------------------------
; - site defined settings -
; ---------------------------------------------------------------------------
; - 1. "$file" log printer information to specified file. it is the prefix value.
; - extension are:
; - - .lst (= historical list with a total list of all configured printers)
; - - .usr (= dynamic list by username)
; - - .def (= dynamic list by printer & username)
; - _debug.txt (= debug information)
; - advise: use a hidden directory on server with read + write access.
; - 2. "$debug_mode". usefull for kixtart programmers.
; - 3. "$debug_file". log printers debug information to specified file.
; --------------------------------------------------------------------------

$file=$tmp_directory+"printers" ; - extension will be added: lst, usr, def -
;

Top
#51710 - 2003-07-09 09:50 AM Re: KIXTART-TOOL: calculates default printer & other printers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, as it does not run at all.
thus, how you call the script?

where you call it from?
_________________________
!

download KiXnet

Top
#51711 - 2003-07-09 06:03 PM Re: KIXTART-TOOL: calculates default printer & other printers
Mikecl Offline
Fresh Scripter

Registered: 2001-12-08
Posts: 18
This seems to be going round in circles

The script fails to find or open the file which I do not know what it is called so effectively the script does not do anything

Top
#51712 - 2003-07-09 06:13 PM Re: KIXTART-TOOL: calculates default printer & other printers
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The 'failed to find/open script' error sounds more like KiXtart is unable to find the script you are calling.

1) Do you have a folder 'c:\printer' as required by the script.
2) Call the script by providing the complete path, e.g KIX32 c:\printer\printer.kix if you saved the script as printer.kix
3) Call the script with an additional debug paramter as in KIX32 /d c:\printer\printer.kix
_________________________
There are two types of vessels, submarines and targets.

Top
#51713 - 2003-07-09 07:25 PM Re: KIXTART-TOOL: calculates default printer & other printers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes.
like already asked.
how are you calling your printers.kix if kixtart is unable to find the script?
_________________________
!

download KiXnet

Top
#51714 - 2003-07-10 09:00 AM Re: KIXTART-TOOL: calculates default printer & other printers
Mikecl Offline
Fresh Scripter

Registered: 2001-12-08
Posts: 18
The script runs but shows an error when trying to find/open the output file. Easiest is to download the printer.kix file run it and see the error message
Top
#51715 - 2003-07-10 09:29 AM Re: KIXTART-TOOL: calculates default printer & other printers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I want you to listen now.

there is no such error string defined in the script!
the script does not call any external script.
it does not "run" or "shell" anything.

the ONLY things that can be wrong is YOUR call or the ERROR you gave us.

now, if you want to know really the fix to this you have 3 choises:
1) if the error you told us is not the correct one, give the correct one.
2) finally let us know how you call it and how you can be sure that it actually executes?
3) don't let us know, just keep wondering by yourself.
_________________________
!

download KiXnet

Top
#51716 - 2003-07-10 09:56 AM Re: KIXTART-TOOL: calculates default printer & other printers
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Mike,

Please try this. Open the printer script file in question and edit it with notepad or similar TEXT editor.

Place the following code on the very first line of the script.

code:
? 'Hello... The script is open.'
? 'Please press a key to continue'
get $

Then move, or copy this script file to C:\TEST
If the folder does not exist, create it.
Then copy KIX32.EXE to the same directory.
Then type the following while in the C:\TEST folder in a DOS prompt.

KIX32.EXE PRINTERS.KIX (or what ever the name of the script file is)

Then let us know what you get.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.2 seconds in which 0.163 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org