This whole thing is badly designed. This type of logic is ideal for .INI files. this will allow you to sue some ratehr generic code and make changes to the printer mappings in the separate .INi file instead of hacking the code.
Example:
Code:
; .INI file
[Printers]
Printer1=user1, user2, Eric
Printer2=user1, user2, user4
Printer3=user1, Eric, user8, user2
KiXtart code:
Code:
$printers=split(readprofilestring('printers.ini','Printers',''),chr(10)
for each $printer in $printers
$users=split(readprofilestring('printers.ini','Printers',$printer),chr(10)
if ascan($users,@USERID)+1
? @USERID+' gets printer '+$printer
endif
next
It's not a best practive to dynamically generate variables, especially as variables generally do not represent information. Information is normally the value assigned to a variable, not the variable name itself.