tjcarst
Hey THIS is FUN
Registered: 2003-09-08
Posts: 243
Loc: USA
|
I would also like to record if there is a local printer in the ini file. Sometimes we have local deskjets on lpt1, but the primary printer is a network laser. Other times it is th deskjet that is the default. I'd like to record both and set correct printer.
I'd prefer that the ini file is used for all printer add/deletes. If we wanted to delete a printer, do it in the ini file, not on the pc.
Here's the current printsetup.kix that generates my existing ini file.
code:
;********** Prevent logon script on server ********* call @ScriptDir+'\osid.udf'
$os=osid() if $os[2]<>'Workstation' exit 0 endif
;********** Prevent logon script for Health Info Mgmt ********* if InGroup ("Medrec Group") exit 0 endif
;********** Beginning of printer info gathering script *********
;Re-Write at http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=004308 ;By Kdyer & Lonkero (15th april 2003)
;Re-Write of http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=10;t=000021
;Default Printer Configuration ;This is to capture the Default Printer and get all network defined printers as well ; Ref. http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=006790 ; Ref. http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000221 $loc='HKEY_CURRENT_USER\Network\LPT1' $reg='HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion' $dev=$reg+'\Devices' $nprt=split(READVALUE($reg+'\Windows','Device'),',')[0] $sysdrv=SUBSTR('%WINDIR%',1,2) dim $priReg, $x, $i, $rc, $ps ; Set Printsetup.ini file location $ps=('\\mrh-01\prtlog$') ;$ps=($ps+'\@wksta'+'_'+'@userid') $ps=($ps+'\@wksta') IF 0=EXIST($ps) MD $ps ENDIF $ps=$ps+'\Printsetup.ini' $i=0 DO IF '\\'=LEFT($x,2) $priReg=$priReg+$x ENDIF $x=ENUMVALUE($dev,$i) $i=$i+1 UNTIL @error IF LEN($priReg) $rc=WRITEPROFILESTRING($ps,'Printers','','') $priReg=split($priReg,'\\') FOR $i=1 to ubound($priReg) $rc=WRITEPROFILESTRING($ps,'Printers',$i,'\\'+$priReg[$i]) NEXT ENDIF SELECT CASE INSTR($nprt,'\\') ;WRITE THE DEFAULT PRINTER TO THE CONFIG $rc=WRITEPROFILESTRING($ps,'Printers','Default',$nprt) USE LPT1: /delete /persistent USE LPT1: $nprt /persistent CASE $nprt='' AND EXIST($ps) ;NO DEFAULT PRINTER, LOAD PRINTERS FROM SAVED INFO FOR EACH $key IN split(readprofilestring($ps,'Printers',''),chr(10)) $nul=addprinterconnection(readprofilestring($ps,'Printers',$key)) NEXT $nprt=READPROFILESTRING($ps,'Printers','Default') $rc=SETDEFAULTPRINTER($nprt) USE LPT1: $nprt /persistent CASE NOT INSTR($nprt,'\\') ;LOCAL PRINTER DEFAULT, SO WE WANT TO REMOVE NETWORK MAPPING USE LPT1: /delete /persistent ENDSELECT
Results of printsetup.kix
[Printers] 1=\\mrh-01\q-mis1 2=\\mrh-01\q-mis2 Default=\\mrh-01\q-mis2 [ 12. October 2003, 21:01: Message edited by: tjcarst ]
|