#42138 - 2003-06-27 11:49 PM
Re: Problem With SetDefaultPrinter
|
Justin Emlay
Fresh Scripter
Registered: 2002-05-24
Posts: 26
|
I'm purly being logical.
For me this works in W2K: SetDefaultPrinter ("SALES_R1045")
For me, it doesn't work in WinXP and I've proven my script is running and so far only I've given input as to why it works for one OS and not the other. I'd heard nothing from anyone else. I've gotten two people telling me two different things. The manual states to use the printer NAME and not the printer PATH
Printer NAME - SALES_R1045 Printer PATH - \\FILE\SALES_R1045
So if someone tells me to use the printer PATH when the manual tells me to use the printer NAME and using the printer NAME actualy works then someone is wrong. Or the manual is wrong and I'm imagining things on my W2K terminal.
Take your pick.
|
Top
|
|
|
|
#42141 - 2003-06-28 12:09 AM
Re: Problem With SetDefaultPrinter
|
Justin Emlay
Fresh Scripter
Registered: 2002-05-24
Posts: 26
|
Lonkero, You are being insulting and you are not helping. I did not know anyone here was the author of anything. How could I and why should I? I am not responding to you anymore. Sealeopard is the only one here actually helping.
Sealeopard, I removed all printers then added one myself. I have to have something to switch from or else one of the newly created printers could become default simply because it was the first created. I shut down the machine completely. Booted the machine. Logged onto the machine and saw the usual in the window, "000". Both printers where added and the old printer remains the default. There is nothing in the log.
I used as you suggested: AddPrinterConnection ("\\FILE\SALES_R1045") AddPrinterConnection ("\\FILE\SALES_FAX") SetDefaultPrinter ("\\FILE\SALES_R1045")
I'm going to drop that fact that this works in W2K: SetDefaultPrinter ("SALES_R1045") And simply consider it a coincidence.
|
Top
|
|
|
|
#42142 - 2003-06-28 12:11 AM
Re: Problem With SetDefaultPrinter
|
Justin Emlay
Fresh Scripter
Registered: 2002-05-24
Posts: 26
|
I forgot the following:
"Can you manually set that particular printer as default printer under Windows XP?" Yes I can install them and set which ever I want as default.
|
Top
|
|
|
|
#42144 - 2003-06-28 04:19 AM
Re: Problem With SetDefaultPrinter
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Justin,
With the FAQ link I referenced, we (the companies I work for) use it on a daily basis to write an INI file to the client's home drive. That is, if they login to another workstation, they get the printers and the default.
Again, we have several XP (or hopped up W2k) machines that this works perfectly with. And more specifically with the method(s) in question.
Thanks,
Kent
|
Top
|
|
|
|
#42145 - 2003-07-01 05:59 PM
Re: Problem With SetDefaultPrinter
|
Justin Emlay
Fresh Scripter
Registered: 2002-05-24
Posts: 26
|
Shooting in the dark...
Where your WinXP machines installed with Service Pack 1 integrated in to the installation files?
Thanks, Justin
|
Top
|
|
|
|
#42146 - 2003-07-11 03:28 PM
Re: Problem With SetDefaultPrinter
|
Anonymous
Anonymous
Unregistered
|
I also wish to map printers in a XP sp1 environment.
This works; $rc=AddPrinterConnection('\\i1print2\i1t41179') $rc=SetDefaultPrinter('\\i1print2\i1t41179')
This fails; $rc=AddPrinterConnection('\\i1print2\i1t41179') $rc=SetDefaultPrinter('i1t41179')
The 4.20 manual gives this example; If AddPrinterConnection ("\\vleerbeer\hp laserjet 4") = 0 ? "Added printer connection...." If SetDefaultPrinter ("\\vleerbeer\hp laserjet 4") = 0 ? "Set default printer to HP LaserJet 4...." Endif Endif
But the syntax is still SETDEFAULTPRINTER("printername")
Needs to be fixed in the manual!
|
Top
|
|
|
|
#42147 - 2003-07-11 03:38 PM
Re: Problem With SetDefaultPrinter
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
Question: Is the share name of the printer "SALES_R1045" identical to the printer name SALES_R1045". This is an important distinction. Additionally, when you look at your printer list, did you refresh the list after running the script?
I do have to agree with Jooel, that the error codes in Kixtrat are very reliable as they are received directly from the Windows API. Aslo, you are the only oen reporting this particular problem, which would indicate that it might rather be a problem with the computer you are testing it on. there at a lot of settings in windows XP, especially security settings wich can influence somethings seemingly as simple as adding printers or setting default printers.
You can always install Windows XP in an out-of-the-box configuration and retest your script. This woudl actually be a necessary step to show whether it's a script, Windows, or configuration problem.
_________________________
There are two types of vessels, submarines and targets.
|
Top
|
|
|
|
#42150 - 2003-07-11 04:15 PM
Re: Problem With SetDefaultPrinter
|
Anonymous
Anonymous
Unregistered
|
Not sure how XP works for sure, but in 2000 the default printer can be set in the registry by using the following line: code:
WRITEVALUE ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "$NewDefPrnt", "REG_SZ")
All you have to do is set the $NewDefPrnt value in your script. This was a line from a script I wrote to change printer settings after moving print queues to another server.
|
Top
|
|
|
|
#42151 - 2003-07-11 05:20 PM
Re: Problem With SetDefaultPrinter
|
Anonymous
Anonymous
Unregistered
|
Lonkero
Ouch! I did read the manual, but it was the one that came when I downloaded 4.20. The version you have seems better - which one is it?
Mine sez: ADDPRINTERCONNECTION Action Adds a connection to the specified printer for the current user.
Syntax ADDPRINTERCONNECTION ("printer name")
Parameters Printer name The (share)name of the printer to which to connect.
|
Top
|
|
|
|
#42155 - 2003-10-06 04:16 PM
Re: Problem With SetDefaultPrinter
|
Duckling
Fresh Scripter
Registered: 2003-10-06
Posts: 5
|
Just to add my 2p:
I have exactly the same problem. W2K works fine, XP does not. Running v4.20, will try 4.21 tomorrow. Printer name and printer share name is exactly the same. I use the following code:
if InGroup("PRINTER501") AddPrinterConnection("\\SERVERNAME\PRINTER501") endif
if InGroup("SOMEDEPT") SetDefaultPrinter("\\SERVERNAME\PRINTER501") endif
|
Top
|
|
|
|
#42156 - 2003-10-06 04:37 PM
Re: Problem With SetDefaultPrinter
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Mr. Duckling - Can you start your own thread on this?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 569 anonymous users online.
|
|
|