Page 1 of 1 1
Topic Options
#152033 - 2005-11-22 10:20 PM setting default printer to workstation
BarryWhite Offline
Fresh Scripter

Registered: 2005-10-24
Posts: 35
Loc: UK
Hello all,
I'm having a problem creating a default printer for a workstation that is a local printer to another workstation.
I've tried using the @userid as well as the @wrksta, but the printer does not install.
Is this correct?

if @WKSTA = Workstation7
AddPrinterConnection ("\\Workstation8\hp LaserJet 1000")
SetDefaultPrinter ("\\Workstation8\hp LaserJet 1000")
? "Added printer connection...."
Endif

Thanks

Top
#152034 - 2005-11-22 10:28 PM Re: setting default printer to workstation
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What exactly is the problem?

When using an IF construct, you should also use the ELSE for debugging to see if your IF is being evaluated as you expect. You also should evalute the return code from ADDPRINTERCONNECTION. See the documentation for details. SETDEFAULTPRINTER also returns the errcode of the operation. You evalute it also. See the example in the docs.

Workstation7 should have quotes around it.


Edited by Howard Bullock (2005-11-22 10:28 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#152035 - 2005-11-22 11:24 PM Re: setting default printer to workstation
BarryWhite Offline
Fresh Scripter

Registered: 2005-10-24
Posts: 35
Loc: UK
Thanks for the response Howard,
The problem is that the printer does not create..
I have used the same code for a user and it works ok.
Can anyone recommend a good (easy to read) kix book?

Top
#152036 - 2005-11-22 11:49 PM Re: setting default printer to workstation
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
think this might be the easiest:
http://www.amazon.com/exec/obidos/tg/detail/-/B0000W86HC/102-4286701-6303356?v=glance
_________________________
!

download KiXnet

Top
#152037 - 2005-11-23 12:25 AM Re: setting default printer to workstation
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
First off, can yuou connect to the printer by browsing to it?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152038 - 2005-11-23 01:23 AM Re: setting default printer to workstation
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and secondly first off, what's the printer's share name.
_________________________
!

download KiXnet

Top
#152039 - 2005-11-23 01:25 AM Re: setting default printer to workstation
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Hey, I was getting to the second (share) part.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152040 - 2005-11-23 08:35 AM Re: setting default printer to workstation
BarryWhite Offline
Fresh Scripter

Registered: 2005-10-24
Posts: 35
Loc: UK
I can browse and connect to it no problem,
The share name is hp Laserjet 1000 which is the same as the printer name.
I have exactly the same script for another user and they connect fine.
Thanks

Top
#152041 - 2005-11-23 10:14 AM Re: setting default printer to workstation
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Have you checked the event logs on the machine in question? Perhaps the user is not able to update the printer drivers on the local machine.

Check the return value (or @ERROR) after calling the functions. If there is an error then display it. If the success of a function or command is important to you then you must check the status and react accordingly.

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
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.079 seconds in which 0.038 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