Page 1 of 1 1
Topic Options
#17699 - 2002-02-20 02:52 PM setdefaultprinter acting up!
Anonymous
Unregistered


Hi guys,

I have been having trouble setting my default printer. I have 2 printers that are connected and i want the Brother Laser printer to be the default. for some reason it wont set as the default but the Epson Laser will? anyone know why?

Heres my code

code:

$SysNom=@WKSTA
if addprinterconnection ("\\Geog1\brother") = 0
at (14,20)"Laser Printer Connected"
endif
if addprinterconnection ("\\upperserver\EpsonU25") = 0
at (15,20)"Colour Printer Connected"
endif
if SetDefaultPrinter ("\\upperserver\EpsonU25") = 0
at (15,20)"Colourr Printer Connected (Default)"
endif
RETURN

Many Thanks
Mike

Top
#17700 - 2002-02-20 03:18 PM Re: setdefaultprinter acting up!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Mike,

So what`s the value of @ERROR after you attempt to setdefault to your Brother printer, my brother ?

Top
#17701 - 2002-02-20 04:26 PM Re: setdefaultprinter acting up!
Anonymous
Unregistered


Hi,

I used the following code to get the result.

code:

if setdefaultprinter("\\upperserver\EpsonU25") = 0
at (15,22) @error
endif

And it returns 0 !

To me thats a succesfull command i;e it set the default printer? but when it comes to print the app says there isnt a a printer installed? because there is no default!

Mike

[ 20 February 2002: Message edited by: mcloum ]

Top
#17702 - 2002-02-20 05:03 PM Re: setdefaultprinter acting up!
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Mike -
Is it only 1 app that does not see the script-set default printer, or all of Windows and the apps? Perhaps issue is the app, not the KiX setting? Also, what O/S are the clients that are failing?

Bill

Top
#17703 - 2002-02-20 05:05 PM Re: setdefaultprinter acting up!
Anonymous
Unregistered


Hi,

Its all the apps that cannot see the default printer. we are using WinNT4 as the O/S

Mike

Top
#17704 - 2002-02-20 05:29 PM Re: setdefaultprinter acting up!
Auke Offline
Fresh Scripter

Registered: 2002-01-31
Posts: 33
Loc: Purmerend, The Netherlands
Mike,

You have to be sure that you ar using the latest kix version. 4.0.2

Then you must use the next code

code:
 if setdefaultprinter ("printer name") = 0
? "Set default printer to printer name..."
endif

Don't use the sharename of the printer but the printer name itself.

Greetz AukeB

_________________________
Greetz AukeB

Top
#17705 - 2002-02-20 06:21 PM Re: setdefaultprinter acting up!
Anonymous
Unregistered


i am using the actual printer name. i shared the printer with the same as the installed name. I am using kixtart 4.02.

Heres what im working with now.

code:

$wksta=@wksta
$a=substr($wksta,6,2) ;take last two char
$what_rm = val($a) ;change to number

delprinterconnection(\\upper01\KyoU26)
delprinterconnection(\\upperserver\EpsonU25)
delprinterconnection(\\upperserver\EpsonA3)
delprinterconnection(\\upperserver\EpsonU18)


;******* ROOM 26 *******

select
case $what_rm <= 30
if addprinterconnection("\\Upper01\KyoU26") = 0
at (15,22) "Laser Printer Connected"
endif
;addprinterconnection("\\Upperserver\EpsonU25")
if setdefaultprinter("\\Upper01\KyoU26") = 0
AT (15,22) "Laser Printer Connected (Default)"
;AT (16,22) "Connected Color Printer"
endif

;****** ROOM 18 ********

case $what_rm >= 30
if addprinterconnection("\\upperserver\EpsonU18") = 0
at (15,22) "Colour Printer Connected"
endif
;addprinterconnection("\\upperserver\EpsonA3")
if setdefaultprinter("\\upperserver\EpsonU18") = 0
AT (15,22) "Colour Printer Connected (Default)"
endif
endselect
return


i cant see anything wrong with the code. I have also discovered that when i debug it as an administrator it works fine, but when a restricture user logs on such as a student, they dont get a default printer. This has only just started doing this and has worked with past version. could it be a bug??

Mike

[ 20 February 2002: Message edited by: mcloum ]

Top
#17706 - 2002-02-21 09:33 AM Re: setdefaultprinter acting up!
Auke Offline
Fresh Scripter

Registered: 2002-01-31
Posts: 33
Loc: Purmerend, The Netherlands
Mike,

I had the same problem. You must look on the workstation to see what the printer name is. Mostly, for HP printers, this could be like:
"HP LaserJet 4050"
and that is the real printer name. If you use that with the setdefaultprinter code everything must be working. And be sure that you have the latest kix.

Greetz AukeB

_________________________
Greetz AukeB

Top
#17707 - 2002-02-21 10:00 AM Re: setdefaultprinter acting up!
Anonymous
Unregistered


Hi,

Ok we are connecting to printers that are installed and shared from the server. The share names are the same as the local name of the printer. ie I installed a epson printer and called it EpsonU18 then shared it with the same name! So you see the names are the same on the share and the server.

Mike

Top
#17708 - 2002-02-21 10:52 AM Re: setdefaultprinter acting up!
Auke Offline
Fresh Scripter

Registered: 2002-01-31
Posts: 33
Loc: Purmerend, The Netherlands
Ok,

I have just tested your script. The only thing I changed was my servername and the sharename. I also renamed the printers to the sharename. And everything was working fine.
So the only thing I can conclude is.

- You are not using the latest kix version.
- You are not working with windows NT/2000 workstations.

Greetz Aukeb.

_________________________
Greetz AukeB

Top
#17709 - 2002-02-21 01:02 PM Re: setdefaultprinter acting up!
Anonymous
Unregistered


Hi,

Thanks for that but i have solved it now!

Heres what my base script that called the priners script.

kix32.exe finalscript.kix
y:\unlockcd d:
x:\con2prt.exe /f
EXIT

The text in bold is a program that i used to disconnect and connect printers before i found Kixtart! /f deletes all printer connectionS!!!!!!!!!!!!!!! IM SO STUPID!

Thanks Guys
Mike

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
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.073 seconds in which 0.026 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