Page 2 of 3 <123>
Topic Options
#42137 - 2003-06-27 11:42 PM Re: Problem With SetDefaultPrinter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
justin, ok.
sure you can say that the software author is wrong and does not know how his software works.

as you, I would twice think before making such statement.
that says directly something about you.
_________________________
!

download KiXnet

Top
#42138 - 2003-06-27 11:49 PM Re: Problem With SetDefaultPrinter
Justin Emlay Offline
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
#42139 - 2003-06-27 11:52 PM Re: Problem With SetDefaultPrinter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
I don't know what you have read.
I took a quote from manual which states what the parameter should be.

it says you MUST use the proper way.
that is what it says to me.

wonder if we are reading different manual...
_________________________
!

download KiXnet

Top
#42140 - 2003-06-27 11:54 PM Re: Problem With SetDefaultPrinter
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Can you manually set that particular printer as default printer under Windows XP? Can you manually connect to that particular printer wiht Windows XP? Have you printed a test page? Are there any entries in the eventlog?

Please remove all printers before attempting to reconnect.
_________________________
There are two types of vessels, submarines and targets.

Top
#42141 - 2003-06-28 12:09 AM Re: Problem With SetDefaultPrinter
Justin Emlay Offline
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 Offline
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
#42143 - 2003-06-28 12:27 AM Re: Problem With SetDefaultPrinter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
thanks for the feedback.
I try not to interfier the life of starter kixters anymore. [Eek!]
_________________________
!

download KiXnet

Top
#42144 - 2003-06-28 04:19 AM Re: Problem With SetDefaultPrinter
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#42145 - 2003-07-01 05:59 PM Re: Problem With SetDefaultPrinter
Justin Emlay Offline
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
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 Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
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
#42148 - 2003-07-11 04:03 PM Re: Problem With SetDefaultPrinter
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Mark K,
Don't take it too literally. The example shows the proper syntax.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#42149 - 2003-07-11 04:09 PM Re: Problem With SetDefaultPrinter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
indeed it seems that manual might have an error.
quote:

Parameters: Printer name
String that specifies the fully qualified name of the printer to set as the default printer. Note that if the printer involved was connected to using AddPrinterConnection, you must include both the servername and the sharename.

but indeed the error is not as you suggested.
your error was that you didn't read the manual.

if there is error, it's about sharename part.
afaik, it should be "\\servername\printername" or ruud has changed something later on that it works this way.
_________________________
!

download KiXnet

Top
#42150 - 2003-07-11 04:15 PM Re: Problem With SetDefaultPrinter
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
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
#42152 - 2003-07-11 05:25 PM Re: Problem With SetDefaultPrinter
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Mark K,
As I already mentioned, the example does offer more. Old manuals cannot be rewritten. They are frozen in time. If you want to make a suggestion for future versions, post it to the suggestions forum.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#42153 - 2003-07-11 05:51 PM Re: Problem With SetDefaultPrinter
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
You should also use the latest KiXtart version, which is v4.21, see 4.21 *final* is now available

[ 12. July 2003, 15:29: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#42154 - 2003-07-11 06:40 PM Re: Problem With SetDefaultPrinter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
now was I rude or what? [Wink]
anyway, still your manual speaks about sharename as printername-parameter.

indeed old manual was more misleading than the current one.
I see no reason why the parameter should be titled as printername as that makes the confusion bigger than it needs to be.
simple reduction to "printer" would already reduce the risk of fatal error [Wink]

anyway, I was reading 4.21 manual...
didn't remember you saing anything about version so just assumed.
version 4.21 is available on other kixtart download locations but not on korg.
as example KiX2001_421.zip
_________________________
!

download KiXnet

Top
#42155 - 2003-10-06 04:16 PM Re: Problem With SetDefaultPrinter
Duckling Offline
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 Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Mr. Duckling - Can you start your own thread on this?
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 3 <123>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 191 anonymous users online.
Newest Members
thequeen, ameliaryan, shalomsalami, dkdssdk, Vroon
17639 Registered Users

Generated in 0.041 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.

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