|
|
|||||||
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 |
||||||||
|
|
|||||||
Arno, Welcome to the board! For this example, why not use LEFT instead? Also, there is no need to use "THEN" either. In fact, it will indeed fail on you. For example - code:It might even be better (depending on how many printers) to do a SELECT..CASE..ENDSELECT statement.IF LEFT(@WKSTA,3)="B01" How many printers are you working with? Kent [ 08. October 2003, 14:34: Message edited by: kdyer ] |
||||||||
|
|
|||||||
Now this day i work with 4 printers. In a few months this number is 20+ I gonna test it right now THNX! |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |