Page 1 of 1 1
Topic Options
#145211 - 2005-08-10 11:43 AM Set Default Printer
Orion Offline
Fresh Scripter

Registered: 2005-08-09
Posts: 10
Loc: London, UK
Good Morning Guys

I am writing a script to install printers when a user logs on (if they don't exist). However I also want to set a default printer, i've looked for the code and I think its:
SETDEFAULTPRINTER ("\\server1\HPlaserjet")


However this doesn't work. Not sure why.
_________________________
"We ride together, We die together, Bad boys for life" - Will Smith "Don't run, you'll only die tired" "When did I realize I was God? Well, I was praying and I suddenly realized I was talking to myself" - Peter O'Toole. Remember; The Arc was built by amateurs but the Titanic was built by professionals.

Top
#145212 - 2005-08-10 01:03 PM Re: Set Default Printer
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
to make sure, is "hplaserjet" the printer's name or the sharename?
_________________________
!

download KiXnet

Top
#145213 - 2005-08-10 01:16 PM Re: Set Default Printer
Orion Offline
Fresh Scripter

Registered: 2005-08-09
Posts: 10
Loc: London, UK
Thanks for the reply.

I'm using the same name as the printer that I am adding.

I have included the code below, the sleep is to make sure that the printer is added, won't be in the real script.

AddPrinterConnection ("\\server1\HP9050")
AT (6,9) "Please wait"
Sleep 20
SETDEFAULTPRINTER ("\\server1\HP9050")
_________________________
"We ride together, We die together, Bad boys for life" - Will Smith "Don't run, you'll only die tired" "When did I realize I was God? Well, I was praying and I suddenly realized I was talking to myself" - Peter O'Toole. Remember; The Arc was built by amateurs but the Titanic was built by professionals.

Top
#145214 - 2005-08-10 02:11 PM Re: Set Default Printer
Lonkero Administrator Offline
KiX Master Guru
*****

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

I'm using the same name as the printer that I am adding.



eh?
to clarify, addprinterconnection takes \\server\sharename but, setdefaultprinter does not accept \\server\sharename. it must get \\server\printername.
_________________________
!

download KiXnet

Top
#145215 - 2005-08-10 03:50 PM Re: Set Default Printer
Orion Offline
Fresh Scripter

Registered: 2005-08-09
Posts: 10
Loc: London, UK
sorry bad reply.

It can't be the name that I am specifing as I add the printer earlier in the script. I check in the printers and faxes and the printer has been added. However when it comes to setting the default printer it doesn't work. The printer default doesn't change.

Hope this is a bit clearer.
_________________________
"We ride together, We die together, Bad boys for life" - Will Smith "Don't run, you'll only die tired" "When did I realize I was God? Well, I was praying and I suddenly realized I was talking to myself" - Peter O'Toole. Remember; The Arc was built by amateurs but the Titanic was built by professionals.

Top
#145216 - 2005-08-10 04:27 PM Re: Set Default Printer
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You're just not getting it. Is the share name and the printer name different?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#145217 - 2005-08-10 06:03 PM Re: Set Default Printer
Orion Offline
Fresh Scripter

Registered: 2005-08-09
Posts: 10
Loc: London, UK
sorry yes
_________________________
"We ride together, We die together, Bad boys for life" - Will Smith "Don't run, you'll only die tired" "When did I realize I was God? Well, I was praying and I suddenly realized I was talking to myself" - Peter O'Toole. Remember; The Arc was built by amateurs but the Titanic was built by professionals.

Top
#145218 - 2005-08-10 06:59 PM Re: Set Default Printer
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Don't say sorry, just answer the question.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#145219 - 2005-08-11 10:29 AM Re: Set Default Printer
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Ok, this is one of the things that frequently catches people out.

The simplest way to avoid an issue is to ensure that your share name and printer name are always exactly the same.

This should fix the problem you are having, and reduce the likelihood that you will have an issue in the future.

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 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.06 seconds in which 0.025 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