Page 1 of 1 1
Topic Options
#124757 - 2004-08-11 06:31 PM help with default printer script
Anonymous
Unregistered


I suck at programing. I borrowed this script from a news group and modified it. I am trying to assign default printers based on Clientname. I am using Kixtart wkix32.exe. The full client name is "buh-ctx2". Does the "-" screw this up? It fails saying I am missing a comma! in the line that starts CASE RIGHT. Can any one help?

----------Script--------------------
USE lpt3 /DELETE

$ClientName = %CLIENTNAME%


SELECT

CASE RIGHT(@$ClientName, 4) = "CTX2"
AddPrinterConnection ("\\buh-ctx1\h-csm-1855")
SetDefaultPrinter ("\\buh-ctx1\h-csm-1855")

ENDSELECT
-------End----------------------

Top
#124758 - 2004-08-11 06:53 PM Re: help with default printer script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No, but the @ would.

RIGHT(@$ClientName, 4)

should be:
RIGHT($ClientName, 4)

Be advised also that it is the printer name and not the share name that is needed. If both are set the same then you are good to go.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124759 - 2004-08-11 08:46 PM Re: help with default printer script
Anonymous
Unregistered


I will give the script below a try.

----------Script--------------------
USE lpt3 /DELETE

$ClientName = %CLIENTNAME%


SELECT

CASE RIGHT($ClientName, 4) = "CTX2"
SetDefaultPrinter ("h-csm-1855")

ENDSELECT
-------End----------------------
Thanks
Pat

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 (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.027 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