#38164 - 2003-03-21 07:54 AM
Computers won't default to designated printers
|
Tim Grech
Lurker
Registered: 2003-03-21
Posts: 4
Loc: Sydney, Australia
|
I am new to Kixtart. Our IT consultant (who we pay heaps) has installed kixtart for our default printer scripting.
All of a sudden two organisational units' computers (W2kServer AD) sometimes won't default to their designated printer. They default to usually two other particular printers in our work place (of at least 10-15).
The script looks OK to me, here it is in full as requested ************************************************* ;XXXX Logon Script 10/9/01 Created XXXXX XXXXXXXXXXXX" ;modified 13/11/01
if @wksta = "lib-1" goto "library" else if @wksta = "lib-2" goto "library" else if @wksta = "lib-3" goto "library" else if @wksta = "lib-4" goto "library" else if @wksta = "lib-5" goto "library" else if @wksta = "lib-6" goto "library" else if @wksta = "lib-7" goto "library" else if @wksta = "lib-8" goto "library" else if @wksta = "lib-9" goto "library" else if @wksta = "lib-10" goto "library" else if @wksta = "lib-11" goto "library" else if @wksta = "lib-12" goto "library" else if @wksta = "lib-13" goto "library" else if @wksta = "lib-14" goto "library" else if @wksta = "lib-15" goto "library" else if @wksta = "lib-16" goto "library" else if @wksta = "lib-17" goto "library" else if @wksta = "lib-18" goto "library" else if @wksta = "lib-19" goto "library" else if @wksta = "lib-20" goto "library" else if @wksta = "lib-21" goto "library" else goto "next"
:next if @Wksta = "libLoft-1" goto "loft" else if @wksta = "libLoft-2" goto "loft" else if @wksta = "libLoft-3" goto "loft" else if @wksta = "libLoft-4" goto "loft" else if @wksta = "libLoft-5" goto "loft" else if @wksta = "libLoft-6" goto "loft" else if @wksta = "libLoft-7" goto "loft" else if @wksta = "libLoft-8" goto "loft" else if @wksta = "libLoft-9" goto "loft" else if @wksta = "libLoft-10" goto "loft" else if @wksta = "libLoft-11" goto "loft" else if @wksta = "libLoft-12" goto "loft" else if @wksta = "libLoft-13" goto "loft" else if @wksta = "libLoft-14" goto "loft" else if @wksta = "libLoft-15" goto "loft" else if @wksta = "libLoft-16" goto "loft" else if @wksta = "libLoft-17" goto "loft" else if @wksta = "libLoft-18" goto "loft" else if @wksta = "libLoft-19" goto "loft" else if @wksta = "libLoft-20" goto "Loft" else goto "next1"
:next1 if @Wksta = "E5-1" goto "e5" else if @Wksta = "E5-2" goto "e5" else if @Wksta = "E5-3" goto "e5" else if @Wksta = "E5-4" goto "e5" else if @Wksta = "E5-5" goto "e5" else if @Wksta = "E5-6" goto "e5" else if @Wksta = "E5-7" goto "e5" else if @Wksta = "E5-8" goto "e5" else if @Wksta = "E5-9" goto "e5" else if @Wksta = "E5-10" goto "e5" else if @Wksta = "E5-11" goto "e5" else if @Wksta = "E5-12" goto "e5" else if @Wksta = "E5-13" goto "e5" else if @Wksta = "E5-14" goto "e5" else if @Wksta = "E5-15" goto "e5" else if @Wksta = "E5-16" goto "e5" else if @Wksta = "E5-17" goto "e5" else if @Wksta = "E5-18" goto "e5" else if @Wksta = "E5-19" goto "e5" else if @Wksta = "E5-20" goto "e5" else goto "next2"
:next2 if @Wksta = "W9-1" goto "w9" else if @Wksta = "W9-2" goto "w9" else if @Wksta = "W9-3" goto "w9" else if @Wksta = "W9-4" goto "w9" else if @Wksta = "W9-5" goto "w9" else if @Wksta = "W9-6" goto "w9" else if @Wksta = "W9-7" goto "w9" else if @Wksta = "W9-8" goto "w9" else if @Wksta = "W9-9" goto "w9" else if @Wksta = "W9-10" goto "w9" else if @Wksta = "W9-11" goto "w9" else if @Wksta = "W9-12" goto "w9" else if @Wksta = "W9-13" goto "w9" else if @Wksta = "W9-14" goto "w9" else if @Wksta = "W9-15" goto "w9" else if @Wksta = "W9-16" goto "w9" else if @Wksta = "W9-17" goto "w9" else if @Wksta = "W9-18" goto "w9" else if @Wksta = "W9-19" goto "w9" else if @Wksta = "W9-20" goto "w9" else goto "next5"
:next3 ;if @Wksta = "admin-1" goto "admin" ;else if @Wksta = "admin-2" goto "admin" ;else if @Wksta = "admin-3" goto "admin" ;else if @Wksta = "admin-4" goto "admin" ;else if @Wksta = "admin-5" goto "admin" ;else if @Wksta = "admin-6" goto "admin" ;else if @Wksta = "admin-7" goto "admin" ;else if @Wksta = "admin-8" goto "admin" ;else if @Wksta = "admin-9" goto "admin" ;else if @Wksta = "admin-10" goto "admin" else goto "next4"
;:next4 ;if @Wksta = "admin-11" goto "admin1" ;else if @Wksta = "admin-12" goto "admin1" ;else if @Wksta = "admin-13" goto "admin1" ;else if @Wksta = "admin-14" goto "admin1" ;else if @Wksta = "admin-15" goto "admin1" ;else if @Wksta = "admin-16" goto "admin1" ;else if @Wksta = "admin-17" goto "admin1" ;else if @Wksta = "admin-18" goto "admin1" ;else if @Wksta = "admin-19" goto "admin1" ;else if @Wksta = "admin-20" goto "admin1" elso goto "next5"
:next5 if @Wksta = "LSF-2" goto "LASERJET" else if @Wksta = "ENGLISH-1" goto "LASERJET" else if @Wksta = "SOCIALSCIENCE-1" goto "LASERJET" else if @Wksta = "HISTORY-2" goto "LASERJET" else if @Wksta = "PE-1" goto "LASERJET" else if @Wksta = "SCIENCE-2" goto "LASERJET" else if @Wksta = "LANGUAGES-1" goto "LASERJET" else if @Wksta = "MATHS-2" goto "LASERJET" else if @Wksta = "TAS-1" goto "LASERJET" else if @Wksta = "HTADMIN-1" goto "LASERJET" else goto "next6"
:Next6 if @Wksta = "LSF-1" goto "LASERJET1" else if @Wksta = "ENGLISH-2" goto "LASERJET2" else if @Wksta = "SOCIALSCIENCE-2" goto "LASERJET3" else if @Wksta = "HISTORY-1" goto "LASERJET4" else if @Wksta = "PE-2" goto "LASERJET5" else if @Wksta = "SCIENCE-1" goto "LASERJET6" else if @Wksta = "LANGUAGES-2" goto "LASERJET7" else if @Wksta = "MATHS-1" goto "LASERJET8" else if @Wksta = "TAS-2" goto "LASERJET9" else if @Wksta = "HTADMIN-2" goto "LASERJET10" else goto "next7"
:Next8 MESSAGEBOX ("PLEASE CHECK YOUR PRINTER SETTINGS BEFORE PRINTING!","DEFAULT PRINTER",0,5) goto "end"
:library ADDPRINTERCONNECTION ("\\ALPHA\LIBRARY") SETDEFAULTPRINTER ("\\ALPHA\LIBRARY") MESSAGEBOX ("Your Default Printer it set to LIBRARY","DEFAULT PRINTER",0,5) goto "end"
:loft ADDPRINTERCONNECTION ("\\ALPHA\LOFT") SETDEFAULTPRINTER ("\\ALPHA\LOFT") MESSAGEBOX ("Your Default Printer it set to LOFT","DEFAULT PRINTER",0,5) goto "end"
:e5 ADDPRINTERCONNECTION ("\\ALPHA\E5") SETDEFAULTPRINTER ("\\ALPHA\E5") MESSAGEBOX ("Your Default Printer it set to E5","DEFAULT PRINTER",0,5) goto "end"
:W9 ADDPRINTERCONNECTION ("\\ALPHA\W9") SETDEFAULTPRINTER ("\\ALPHA\W9") MESSAGEBOX ("Your Default Printer it set to W9","DEFAULT PRINTER",0,5) goto "end"
:admin ADDPRINTERCONNECTION ("\\ALPHA\ADMIN") SETDEFAULTPRINTER ("\\ALPHA\ADMIN") MESSAGEBOX ("Your Default Printer it set to ADMIN","DEFAULT PRINTER",0,5) goto "end"
:admin1 ADDPRINTERCONNECTION ("\\ALPHA\ADMIN1") SETDEFAULTPRINTER ("\\ALPHA\ADMIN1") MESSAGEBOX ("Your Default Printer it set to ADMIN1","DEFAULT PRINTER",0,5) goto "end"
:w3 ADDPRINTERCONNECTION ("\\ALPHA\W3") SETDEFAULTPRINTER ("\\ALPHA\W3") MESSAGEBOX ("Your Default Printer it set to W3","DEFAULT PRINTER",0,5) goto "end"
:LASERJET SETDEFAULTPRINTER ("LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet (Local)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET1 SETDEFAULTPRINTER ("\\LSF-2\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on LSF-2)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET2 SETDEFAULTPRINTER ("\\ENGLISH-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on ENGLISH-1)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET3 SETDEFAULTPRINTER ("\\SOCIALSCIENCE-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on SOCIALSCIENCE-1)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET4 SETDEFAULTPRINTER ("\\HISTORY-2\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on HISTORY-2)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET5 SETDEFAULTPRINTER ("\\PE-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on PE-1)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET6 SETDEFAULTPRINTER ("\\SCIENCE-2\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on SCIENCE-2)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET7 SETDEFAULTPRINTER ("\\LANGUAGES-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on LANGUAGES-1)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET8 SETDEFAULTPRINTER ("\\MATHS-2\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on MATHS-2)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET9 SETDEFAULTPRINTER ("\\TAS-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on TAS-1)","DEFAULT PRINTER",0,5) goto "end"
:LASERJET10 SETDEFAULTPRINTER ("\\HTADMIN-1\LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet on HTADMIN-1)","DEFAULT PRINTER",0,5) goto "end"
:end endif **************************************************
I am assuming in the next5 bunch of statements all the printers are called LASERJET (without a number) because the printer is connected to that computer and LASERJET is the default name in LPT1 whereas in the next6 bunch of lines each printer has a number (ie LASERJET2).
It only defaults to the wrong printer sometimes and the old fuddies at my work can't handle this!
Any ideas? Sounds like a profiles problem? Do I need to add more info? Happens to all users but same computers. [ 24. March 2003, 08:33: Message edited by: Tim Grech ]
|
|
Top
|
|
|
|
#38167 - 2003-03-21 03:12 PM
Re: Computers won't default to designated printers
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
Just taking a cursory look at the script your consultant produced, I'd say it's time to let him go and do it yourself. I can't believe that he maps default printers by checking each computername in multiple IFs and then uses GOTOs to jump all over the place inside that script.
There are more effecive, elegant and, simpler ways to accomplish this. One way would be, yes, my favirote toy, the .INI file:
code:
; printers.ini [Defaults] LASERJET=LSF-2,LSF-4,LSF-6 LASERJET1=LSF-1,LSF-3,LSF-5
KiXtart:
code:
; KiXtart 4.20 $defaultprinters=split(readprofilestring('printers.ini','Defaults',''),chr(10)) for each $printer in $$defaultprinters $comps=split($readprofilestring('printers.ini','Defaults'$printer),chr(10)) if ascan($comps,@WKSTA) $rc=setdefaultprinter($printer) endif next
This is just a framework, there are other ways to do this. [ 21. March 2003, 15:13: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#38168 - 2003-03-24 09:03 AM
Re: Computers won't default to designated printers
|
Tim Grech
Lurker
Registered: 2003-03-21
Posts: 4
Loc: Sydney, Australia
|
In answer to some questions
1. I'm using Kix32 (I think) 2. We only have 200 clients but can supprot others 3. Problem started about 4-5months ago (after we got some more computers & printers (significant??)) 4. Nobody admits to anything! 5. 6. Complete script above
How could it be a poliy problem? Sounds interesting.
|
|
Top
|
|
|
|
#38173 - 2003-03-25 05:02 AM
Re: Computers won't default to designated printers
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
First, a great welcome to this board.
It is a pity, that your organization is playing a great amount of money, when he had made those changes or when he had implement kixtart in your organization with such a script.
First we verify your script version with our tool kixstrip, which you can find on our site. During the call
kixstrip input.kix output.kix /block_check
we get following output on the screen
code:
Kixstrip 4.20 (vs 4.00e) (c) MCA - scripting@wanadoo.nl - 2003 Kixstrip 4.20 (vs 4.00e) 0.76 (sec)
input 243 input.kix output 243 output.kix (skip: 0 blocks: 0 labels: 26) block_check -ERROR- block_errors=100 block_structures=101 labels=26 tab=6 (default)
Warning KIXSTRIP: 100 errors in block structure(s). missing statement(s). - do:until [0:0] - for|each:in|to:step|next [0|0:0|0:0|0] - function:endfunction [0:0] -ERROR- - if:else:endif [101:101:1] - select:case:endselect [0:0:0] - while:loop [0:0] 101 block_structures found. Informative KIXSTRIP: no UDF's found. Warning KIXSTRIP: some lines contains errors or possible errors.
active options: /Block_Check /Headers /Print /Show_Structure /TAB=6 /Translate inactive options: /NoCombine /NoDebug /NoPerformance /NoProgress /NoShow_Errors /NoLicense: (not.specified)
Some of our remarks:
- indeed missing the "next7" label.
- script can't run on kixtart 4.x releases. You are using "NEXT" as a label.
- very bad IF/ELSE/ENDIF structure.
- with the great amount of GOTO's it is hard to read what is really going on.
- "admin"-part became comment. strange way of doing.
- "next8" label not reachable.
- "w3" label not reachable. selection on a W3-group also not there.
After some modifications we get following script, which should run on different kixtart 3.6x and 4.x releases. In our version we are using different kind of lists. As separator between workstations we are using the "="-symbol. It will prevent problems with names like "lib-1" and "lib-11", "lib-12", ..., "lib-19", etc. In the SELECT/CASE/ENDSELECT we are setting some variables, which we are using in the GOSUB procedure. Also we have include some error handling. Error handling to make it much easier to see what is going wrong. Our version:
code:
;XXXX Logon Script 10/9/01 Created XXXXX XXXXXXXXXXXX" ; ; last modified 25 March 2003
$wksta=@wksta GOSUB check_printer EXIT :check_printer $lib_list="=lib-1=lib-2=lib-3=lib-4=lib-5=lib-6=lib-7=lib-8=lib-9=lib-10="+ "=lib-11=lib-12=lib-13=lib-14=lib-15=lib-16=lib-17=lib-18=lib-19=lib-20="+ "=lib-21=" $libLoft_list="=libLoft-1=libLoft-2=libLoft-3=libLoft-4=libLoft-5=libLoft-6=libLoft-7=libLoft-8=libLoft-9=libLoft-10="+ "=libLoft-11=libLoft-12=libLoft-13=libLoft-14=libLoft-15=libLoft-16=libLoft-17=libLoft-18=libLoft-19=libLoft-20=" $E5_list="=E5-1=E5-2=E5-3=E5-4=E5-5=E5-6=E5-7=E5-8=E5-9=E5-10="+ "=E5-11=E5-12=E5-13=E5-14=E5-15=E5-16=E5-17=E5-18=E5-19=E5-20=" $W9_list="=w9-1=w9-2=w9-3=w9-4=w9-5=w9-6=w9-7=w9-8=w9-9=w9-10="+ "=w9-11=w9-12=w9-13=w9-14=w9-15=w9-16=w9-17=w9-18=w9-19=w9-20=" $laserjet1_list="=LSF-2=ENGLISH-1=SOCIALSCIENCE-1=HISTORY-2=PE-1=SCIENCE-2=LANGUAGES-1=MATHS-2=TAS-1=HTADMIN-1=" $laserjet2_list="=LSF-1=ENGLISH-2=SOCIALSCIENCE-2=HISTORY-1=PE-2=SCIENCE-1=LANGUAGES-2=MATHS-1=TAS-2=HTADMIN-2=" ; $printer="" $printer_name="" SELECT CASE (Instr($lib_list, "="+$wksta+"=") <> 0) ; lib-1 .. lib-21 $printer="LIBRARY" $printer_name="\\ALPHA\LIBRARY" CASE (Instr($libLoft_list, "="+$wksta+"=") <> 0) ; libLoft-1 .. libLoft-20 $printer="LOFT" $printer_name="\\ALPHA\LOFT" CASE (Instr($E5_list, "="+$wksta+"=") <> 0) ; E5-1 .. E5-20 $printer="E5" $printer_name="\\ALPHA\E5" CASE (Instr($w9_list, "="+$wksta+"=") <> 0) ; w9-1 .. w9-20 $printer="W9" $printer_name="\\ALPHA\W9" CASE (Instr($laserjet1_list, "="+$wksta+"=") <> 0) ; lsf-2 .. htadmin-1 $printer="" $printer_name="LASERJET" ; - connecting to "HP LaserJet (Local)" CASE (Instr($laserjet2_list, "="+$wksta+"=") <> 0) ; lsf-1 .. htadmin-2 $printer=Substr($laserjet1_list, Instr($laserjet2_list, "="+$wksta+"=")+1, Len($wksta)) $printer_name="\\$printer\LASERJET" CASE 1 $=MessageBox("Problems with finding a printer for you","Warning about setting Default Printer",0,5) ENDSELECT IF ($printer <> "") OR ($printer_name <> "") GOSUB set_default_printer ENDIF RETURN :set_default_printer ? "Try to Set '$printer' / '$printer_name' for workstation '$wksta'" IF ($printer <> "") IF (AddPrinterConnection("$printer_name") <> 0) $=MessageBox("Problems with connection your default printer $printer"+CHR(13)+"error code @error (@serror)","Warning about setting Default Printer",0,5) ELSE IF (SetDefaultPrinter("$printer_name") <> 0) $=MessageBox("Problems with setting your default printer $printer"+CHR(13)+"error code @error (@serror)","Warning about setting Default Printer",0,5) ELSE $=MessageBox("Your Default Printer it set to $printer","Info about setting Default Printer",0,5) ENDIF ENDIF ELSE IF (SetDefaultPrinter("$printer_name") <> 0) $=MessageBox("Problems with setting your default printer $printer_name (local)"+CHR(13)+"error code @error (@serror)","Warning about setting Default Printer",0,5) ELSE $=MessageBox("Your Default Printer it set to $printer_name (local)","Info about setting Default Printer",0,5) ENDIF ENDIF ;$=MessageBox("Please check your printer settings before printing!","Info about setting Default Printer",0,5) RETURN
For testing we have include following lines at the beginning
code:
$wksta="lib-9" GOSUB check_printer $wksta="libLoft-15" GOSUB check_printer $wksta="E5-5" GOSUB check_printer $wksta="w9-17" GOSUB check_printer $wksta="LSF-1" GOSUB check_printer $wksta="LSF-2" GOSUB check_printer $wksta="PE-1" GOSUB check_printer $wksta="PE-2" GOSUB check_printer EXIT
Output in DOS box is
code:
Try to Set 'LIBRARY' / '\\ALPHA\LIBRARY' for workstation 'lib-9' Try to Set 'LOFT' / '\\ALPHA\LOFT' for workstation 'libLoft-15' Try to Set 'E5' / '\\ALPHA\E5' for workstation 'E5-5' Try to Set 'W9' / '\\ALPHA\W9' for workstation 'w9-17' Try to Set 'LSF-2' / '\\LSF-2\LASERJET' for workstation 'LSF-1' Try to Set '' / 'LASERJET' for workstation 'LSF-2' Try to Set '' / 'LASERJET' for workstation 'PE-1' Try to Set 'PE-1' / '\\PE-1\LASERJET' for workstation 'PE-2'
greetings. btw: of course it is possible to reduce this script, but we were going for the newbies. [ 25. March 2003, 05:04: Message edited by: MCA ]
|
|
Top
|
|
|
|
#38174 - 2003-03-25 07:27 AM
Re: Computers won't default to designated printers
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
One comment with the 1 thru 20/21 thing, why not use a FOR..NEXT with a counter? That would be even cleaner.
Kent
|
|
Top
|
|
|
|
#38175 - 2003-03-25 08:25 AM
Re: Computers won't default to designated printers
|
Tim Grech
Lurker
Registered: 2003-03-21
Posts: 4
Loc: Sydney, Australia
|
WOW!
I'll have to study your replies and scripts more closely - I only looked at the manual the first tim last week!
I beleieve you all that it is messy, but will it work? It seems to work all the time except for the two organisational untits where the LSF and MATHS computers are held.
Our IT Consultant suggested wiping off all the printers in Control Panel and reinstalling only the one we need for the computers affected. Could windows/kixstart be getting confused because there are many printers installed/added by one user? I'm just not sure yet if it's a problem with the script.
In answer to NTDOC, yes we do use roaming profiles, that is why we set default printer at every log in (this makes sense to me but I'm sure I'll be shown the light by somebody). This has been highly educational!
|
|
Top
|
|
|
|
#38176 - 2003-03-25 08:43 AM
Re: Computers won't default to designated printers
|
Tim Grech
Lurker
Registered: 2003-03-21
Posts: 4
Loc: Sydney, Australia
|
I actually thought it was very easy to read and figure out what was going on. Maybe that's why it's done this way.
|
|
Top
|
|
|
|
#38177 - 2003-03-25 09:08 AM
Re: Computers won't default to designated printers
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Tim,
Looked at your code a bit..
Here is the re-worked version (untested, but you get the idea)
code:
CLS BREAK ON DIM $i
FOR $i=1 TO 21 IF @wksta = 'lib-'+$i ADDPRINTERCONNECTION ("\\ALPHA\LIBRARY") SETDEFAULTPRINTER ("\\ALPHA\LIBRARY") MESSAGEBOX ("Your Default Printer it set to LIBRARY","DEFAULT PRINTER",0,5) QUIT ENDIF NEXT
FOR $i=1 TO 20 IF @wksta = 'libLoft-'+$i ADDPRINTERCONNECTION ("\\ALPHA\LOFT") SETDEFAULTPRINTER ("\\ALPHA\LOFT") MESSAGEBOX ("Your Default Printer it set to LOFT","DEFAULT PRINTER",0,5) QUIT ENDIF NEXT
FOR $i=1 TO 20 IF @wksta = 'E5-'+$i ADDPRINTERCONNECTION ("\\ALPHA\E5") SETDEFAULTPRINTER ("\\ALPHA\E5") MESSAGEBOX ("Your Default Printer it set to E5","DEFAULT PRINTER",0,5) QUIT ENDIF NEXT
FOR $i=1 TO 20 IF @wksta = 'W9-'+$i ADDPRINTERCONNECTION ("\\ALPHA\W9") SETDEFAULTPRINTER ("\\ALPHA\W9") MESSAGEBOX ("Your Default Printer it set to W9","DEFAULT PRINTER",0,5) QUIT ENDIF NEXT
$name = Split("LSF-2~ENGLISH-1~SOCIALSCIENCE-1~HISTORY-2~PE-1~SCIENCE-2~LANGUAGES-1~MATHS-2~TAS-1~HTADMIN-1","~")
FOR EACH $element IN $name IF @wksta = $element SETDEFAULTPRINTER ("LASERJET") MESSAGEBOX ("Your Default Printer it set to HP LaserJet (Local)","DEFAULT PRINTER",0,5) QUIT ENDIF NEXT
SELECT CASE @wksta = "LSF-1" MAPPRINT("\\LSF-2\LASERJET","LSF-2") CASE @wksta = "ENGLISH-2" MAPPRINT("\\ENGLISH-1\LASERJET","\\ENGLISH-1") CASE @wksta = "SOCIALSCIENCE-2" MAPPRINT("\\SOCIALSCIENCE-1\LASERJET","\\SOCIALSCIENCE-1") CASE @wksta = "HISTORY-1" MAPPRINT("\\HISTORY-2\LASERJET","\\HISTORY-2") CASE @wksta = "PE-2" MAPPRINT("\\PE-1\LASERJET","\\PE-1") CASE @wksta = "SCIENCE-1" MAPPRINT("\\SCIENCE-2\LASERJET","\\SCIENCE-2") CASE @wksta = "LANGUAGES-2" MAPPRINT("\\LANGUAGES-1\LASERJET","\\LANGUAGES-1") CASE @wksta = "MATHS-1" MAPPRINT("\\MATHS-2\LASERJET","\\MATHS-2") CASE @wksta = "TAS-2" MAPPRINT("\\TAS-1\LASERJET","\\TAS-1") CASE @wksta = "HTADMIN-2" MAPPRINT("\\HTADMIN-1\LASERJET","\\HTADMIN-1") ENDSELECT
:next8 MESSAGEBOX ("PLEASE CHECK YOUR PRINTER SETTINGS BEFORE PRINTING!","DEFAULT PRINTER",0,5) QUIT
FUNCTION MAPPRINT($defprtr,$ptrname) SETDEFAULTPRINTER ($defprtr) MESSAGEBOX ("Your Default Printer it set to HP LaserJet on "+$ptrname+")","DEFAULT PRINTER",0,5) QUIT ENDFUNCTION
:w3 ADDPRINTERCONNECTION ("\\ALPHA\W3") SETDEFAULTPRINTER ("\\ALPHA\W3") MESSAGEBOX ("Your Default Printer it set to W3","DEFAULT PRINTER",0,5) QUIT
:END
The only caveat to this change-over, you will need KiXtart version 4.x or better to run this.
HTH,
Kent
|
|
Top
|
|
|
|
#38181 - 2003-03-28 01:09 AM
Re: Computers won't default to designated printers
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Kent,
We were using this code, because it is possible that they run it on a Kixtart 3.x release. See our remark about label "next". Also it was the reason we are using an UDF.
Of course with the latest Kixtart functionalities we can reduce our script also.
greetings.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|