#115889 - 2004-03-11 06:41 PM
Re: How to refer to a value of a variable as it ...
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
What's with splitting, joining, splitting? why not just:
Code:
$ini='d:\printer.ini' $printers=split(readprofilestring($ini,'Printers',''),chr(10)) for each $printer in $printers $users=split(readprofilestring($ini,'Printers',$printer), ',') if ascan($users,@USERID)+1 ? @USERID+' gets printer '+$printer endif next
_________________________
Eric
|
Top
|
|
|
|
#115892 - 2004-03-11 06:54 PM
Re: How to refer to a value of a variable as it ...
|
Shadow_van
Fresh Scripter
Registered: 2004-03-10
Posts: 13
|
Quote:
If his KiX is too old for Split(), then Ascan() would not yeild any better mileage.
Guys, I started using Kixtart when it was 4.21. It cannot be TOO old, can it? I check your codes with kixtart 4.22, so let's not consider that point.
|
Top
|
|
|
|
#115894 - 2004-03-11 07:12 PM
Re: How to refer to a value of a variable as it ...
|
Shadow_van
Fresh Scripter
Registered: 2004-03-10
Posts: 13
|
Ok. There's my c:\printers.ini file: [Printers] Printer1=andry,mark,gwen,nick Printer2=raman,helen,dave Printer3=wendy,mavis,nicole
I ran the following code: Break On ?@STARTDIR ?@SCRIPTexe ?@KIX ?@SCRIPTDIR $ini='c:\printer.ini' $printers=split(readprofilestring($ini,'Printers',''),chr(10)) for each $printer in $printers $users=split(readprofilestring($ini,'Printers',$printer), ',') if ascan($users,@USERID)+1 ? @USERID+' gets printer '+$printer EndIf Next Sleep 1000
=========== I used the macros to give you some ideas about kixtart version etc. My USERID is andry
The Output I get from the script above is: C:\Program Files\PrimalScript\andry\Scripts KIX32.EXE 4.22 C:\Program Files\PrimalScript\andry\Scripts In other words, it just prints the macroses and then goes to the SLEEP statemnt. I've traced the script and it appears that $users array is never built properly that's why it cannot find my userid in the $users array.
Thanks for spending your time on my issue.
|
Top
|
|
|
|
#115896 - 2004-03-11 07:27 PM
Re: How to refer to a value of a variable as it ...
|
Shadow_van
Fresh Scripter
Registered: 2004-03-10
Posts: 13
|
Quote:
That's why your .INI file is called C:\PRINTERS.INI and in the script you call C:\PRINTER.INI.
It works now!
DAMN! I ain't that stupid, I swear! BUT I DID THAT MISTAKE! Thanks a lot for your help!
One more time appreciate your help!
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 980 anonymous users online.
|
|
|