#143816 - 2005-07-19 03:42 PM
check for machine name in a file
|
caradid
Lurker
Registered: 2005-07-19
Posts: 4
|
Hi all, I'm not an expert in kixtart, I want to find how i can check the existence of a worstation name in a file listing them by using the variable @wksta, instead of using the command below if instr(@wksta,"kdpp4zp") or instr(@wksta,"kdwn3dw") with a lot of or instructions. Could somebody help me on this one ? Thanks in advance.
|
|
Top
|
|
|
|
#143817 - 2005-07-19 03:45 PM
Re: check for machine name in a file
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
How many workstation names are in the file?
You could use Readline and place the name of the workstations into an array then ASCAN() to find it.
|
|
Top
|
|
|
|
#143819 - 2005-07-19 03:59 PM
Re: check for machine name in a file
|
caradid
Lurker
Registered: 2005-07-19
Posts: 4
|
i have about 130 machine names,i want to check an excel file or csv file to see if the machine executing the script is listed in the file, if in the file i want to run a shell command. This list of machines will change everyday. Thank you for your help
|
|
Top
|
|
|
|
#143820 - 2005-07-19 04:04 PM
Re: check for machine name in a file
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
see the UDF ReadFile(), in the UDF forum.
It will read a file into an array for you, then use ascan as howard suggested
|
|
Top
|
|
|
|
#143823 - 2005-07-20 02:11 PM
Re: check for machine name in a file
|
caradid
Lurker
Registered: 2005-07-19
Posts: 4
|
i tried this: if ""<>readprofilestring("c:\test kix\wksta.ini","name",@wksta) shell "v:\setup\sms\remsms.bat" endif
in wksta file : [name] @wksta = KDWN3DW @wksta = kdpp4zp
The shell command doesn't run, any idea where i'm wrong ?
|
|
Top
|
|
|
|
#143824 - 2005-07-20 02:34 PM
Re: check for machine name in a file
|
caradid
Lurker
Registered: 2005-07-19
Posts: 4
|
I found the solution, bad entries in the ini file [name] KDWN3DW = @wksta kdpp4zp = @wksta
and the code to run is : ;Remove SMS Client $dev = readprofilestring("c:\test kix\wksta.ini","name",@wksta) if @ERROR = 0 shell "v:\setup\sms\remsms.bat" endif
Thank you everybody for your help, this forum is very helpfull.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 400 anonymous users online.
|
|
|