#168043 - 2006-09-19 04:29 AM
Default Printer Problem
|
kuwahard
Fresh Scripter
Registered: 2005-09-09
Posts: 8
|
Have kind of a strange problem or maybe not so strange is my hope to people on here 
Here's part of the login script code I use to set my default printer for a computer lab. Both the name of the printer and the share/queue are the same name. Also the people using this lab only have User level rights.
OS: Windows XP SP2
Code:
if $Location = "Milne" ? "Mapping Milne Main Printers" If AddPrinterConnection ("\\onid-print\scf_main") = 0 ? "Added printer connection...." Endif If SetDefaultPrinter ("\\onid-print\scf_main") = 0 ? "Set default printer to SCF Milne Main Printer" Endif
Now this script works (as in sets the correct Default Printer) only about 20% of time on the first run. If I run the script several times in a row, then it works. However I would rather not run the script 10 times in a row just to get this setting to stick. I realize it is supposed to return an error code if it cannot find the printer?, however it does not return on, suggesting it is finding the printer. Does anybody have any suggestions on how to make the default printer stick on the first run and/or some way of testing to see if the default printer is set other then using this function.
Daniel.
|
|
Top
|
|
|
|
#168052 - 2006-09-19 10:21 PM
Re: Default Printer Problem
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Quote:
Printer Config Printer Name: HP LaserJet 6L Share Name: HPLaserJ PC Name: richardpc
Code:
SetDefaultPrinter("\\richardpc\HPLaserJ") ? 'Error: '+@ERROR+': '+@SERROR
Quote:
Error: 2: The system cannot find the file specified.
Code:
SetDefaultPrinter("HPLaserJ") ? 'Error: '+@ERROR+': '+@SERROR
Quote:
{Error: 2: The system cannot find the file specified.
Code:
SetDefaultPrinter("HP LaserJet 6L") ? 'Error: '+@ERROR+': '+@SERROR
Quote:
Error: 0: The operation completed successfully.
As you can see the last code that uses the printer lable name works, tested using Windows XP SP2.
IIRC you need admin rights to set default printer under Windows XP SP2 as well, will report back but I think it has been reported in old posts.
Thanks
Rich
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|