Page 1 of 1 1
Topic Options
#163075 - 2006-06-07 09:16 PM How do I retrieve text from a text file to qualify an If Then statement
corey Offline
Fresh Scripter

Registered: 2006-05-09
Posts: 7
I have been using Kixtart for a few years but I have not tapped many of it's features and am only using kixtart on a limited basis so much of it is unknown to me.

I have a csv file that I write information about each computer to when the user logs into the network.

Currently each time a computer logs into the network the computer logs another line of the same information to the file.

The line is listed below (I shortened it up a little).
$LogText="@WKSTA,@USERID,@ADDRESS,@IPADDRESS0"


I would like to check the file for a value and if it exists I would like to exit the Kixtart Script and not write a new line. The value I would like to find is the computer name (@wksta) and it is the first value in each row.

Is this possible?
Any help is greatly appreciated.
Thank You

Top
#163076 - 2006-06-07 10:00 PM Re: How do I retrieve text from a text file to qualify an If Then statement
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Why not save to an INI file instead and that way you can update the data rather than append it?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163077 - 2006-06-07 11:00 PM Re: How do I retrieve text from a text file to qualify an If Then statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
"then" is not a kixtart keyword.
and thus, there is no such thing as "if then" statement.
_________________________
!

download KiXnet

Top
#163078 - 2006-06-08 02:31 PM Re: How do I retrieve text from a text file to qualify an If Then statement
corey Offline
Fresh Scripter

Registered: 2006-05-09
Posts: 7
My initial thought with having a csv file is that I could have all of the computers information stored in a single file. This way we can sort records to help us find issues more quickly (like outdated software).

I am not sure of all of my options and what would be the best approach so I do appreciate the feedback.

If I use an ini file, can I update it or will the file get overwritten each time. I think this option may work though.

Top
#163079 - 2006-06-08 02:37 PM Re: How do I retrieve text from a text file to qualify an If Then statement
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Have each workstation write to an INI file named @WkSta.ini and then have an admin script that reads the INIs and create a CSV from them.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163080 - 2006-06-08 02:45 PM Re: How do I retrieve text from a text file to qualify an If Then statement
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you want to take the lazy way, you could have eack @WkSta create its own like named one line CSV and then you can just concatenate all the files together.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 293 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.054 seconds in which 0.024 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