Page 1 of 1 1
Topic Options
#160909 - 2006-04-19 11:21 AM SetDefaultPrinter Problem
sascha Offline
Fresh Scripter

Registered: 2005-12-29
Posts: 5
Loc: Germany
Hi all,

I use the following "function" to set my default Printers.
Code:

Function PrinterDef($Printer)
If SetDefaultPrinter ("$Printer") = 0
? " Drucker $Printer als Standarddrucker ausgewählt..."
Else
Color $BrightColor
? " Drucker $Printer konnte nicht als Standarddrucker ausgewählt werden (@ERROR)"
Color $RegColor
Beep
EndIf
Exit @ERROR
EndFunction



Everyrthing seems to work fine so far. But some pieces of software can't find the default printer I set in this manner, some others do.
If I use a piece of visual basic script (prnmngr.vbs) everything works fine. The problem is, that the prnmngr.vbs only works on xp and above.

Is there anyone who experienced this problem before?


Thanks in advance


Sascha

Top
#160910 - 2006-04-19 01:26 PM Re: SetDefaultPrinter Problem
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
What is $Printer ?

It should be a:

"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."

[quoting the manual here]
_________________________



Top
#160911 - 2006-04-19 04:21 PM Re: SetDefaultPrinter Problem
sascha Offline
Fresh Scripter

Registered: 2005-12-29
Posts: 5
Loc: Germany
sure...

this is used as a function where $Printer = \\server\printer.
It doesn't matter if it's used in a function or not.
There just seems to be a problem with the default printers set by kix. If I set the default printer manually or by prnmngr.vbs everything works...

Top
#160912 - 2006-04-19 04:40 PM Re: SetDefaultPrinter Problem
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Just need to check - are you aware of:
Quote:


SetDefaultPrinter( )
Action: Sets the default printer to which applications send print jobs.

Syntax: SETDEFAULTPRINTER ("printer name")

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.

Returns:
0 Default printer set
Error code Function failed





Edited by ewook (2006-04-19 04:43 PM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#160913 - 2006-04-19 04:49 PM Re: SetDefaultPrinter Problem
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh hey, just for the case you have set NoVarsInStrings to ON you should edit the following :

Code:

If SetDefaultPrinter ("$Printer") = 0



to:

Code:

If SetDefaultPrinter ($Printer) = 0



... If I think twice edit that anyways and retry

and..
Quote:


But some pieces of software can't find the default printer





which are these ?


Edited by Jochen (2006-04-19 04:51 PM)
_________________________



Top
#160914 - 2006-04-21 10:33 PM Re: SetDefaultPrinter Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Quote:


Note that if the printer involved was connected to using AddPrinterConnection, you must include both the servername and the sharename.





well, by this time, think we all should have already learned from the huge amount of discussion that this is wrong.
you must NOT use the sharename but printer name.
_________________________
!

download KiXnet

Top
#160915 - 2006-04-24 07:41 PM Re: SetDefaultPrinter Problem
sascha Offline
Fresh Scripter

Registered: 2005-12-29
Posts: 5
Loc: Germany
I think the syntax is alright, because If I insert the printer share instead of the printer name the setdefaultprinter command fails.
But in my case the command works and returns NO error.

The software is some special "custom made" but the problem also shows up in OpenOffice.org 2.0.
Other applications like IE (if you want to call this an application at all) or Mozilla Firefox work just fine.


Sascha


Edited by sascha (2006-04-24 07:44 PM)

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.219 seconds in which 0.196 seconds were spent on a total of 12 queries. Zlib compression enabled.

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