Page 1 of 1 1
Topic Options
#77014 - 2003-10-08 02:28 PM Printer Assignment per Workstation
Arno.v.Rijn Offline
Lurker

Registered: 2003-10-08
Posts: 3
Hey,

I have the following problem:
I want to assign a printer to a workstation when the first 3 digits are valid to the one entered

Example:
Workstation B01W12543 must get printer B01P10126

When i logon the printer is not present.
When i assign a printer per group (if ingroup) everything works fine.

IF (SUBSTR(@WKSTA,1,3)="B01"then
Addprinterconnection("\\edu01\B01P10126")
SETDEFAULTPRINTER("B01P10126")

Who can help me?

Already thnx

Arno

Top
#77015 - 2003-10-08 02:32 PM Re: Printer Assignment per Workstation
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Arno,

Welcome to the board!

For this example, why not use LEFT instead?

Also, there is no need to use "THEN" either. [Wink] In fact, it will indeed fail on you.

For example -
code:
IF LEFT(@WKSTA,3)="B01"
;do stuff
ENDIF

It might even be better (depending on how many printers) to do a SELECT..CASE..ENDSELECT statement.

How many printers are you working with?

Kent

[ 08. October 2003, 14:34: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#77016 - 2003-10-08 02:42 PM Re: Printer Assignment per Workstation
Arno.v.Rijn Offline
Lurker

Registered: 2003-10-08
Posts: 3
Now this day i work with 4 printers. In a few months this number is 20+

I gonna test it right now THNX!

Top
#77017 - 2003-10-08 02:47 PM Re: Printer Assignment per Workstation
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Look into the use of SELECT..CASE..ENDSELECT

This will serve you well with this as you are looking for the first true condition based on a workstation name.

When you get to the 20, you may want to take it up a notch and do this on an array. Look into the use of "SPLIT".

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#77018 - 2003-10-08 06:02 PM Re: Printer Assignment per Workstation
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Or even create a .INI file with an appropriate structure and utilizing READPROFILESTRING. See e.g. UnmapPrinters() - Removes mapped printers not listed in an .INI file
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 262 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

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