Page 1 of 1 1
Topic Options
#123870 - 2004-07-26 10:15 AM The opposite of writeline
Richard_Drahcir Offline
Lurker

Registered: 2004-07-26
Posts: 3
I've made a script that writes a line (%computername%) to a .txt file

Another script that i'am making is reading the (%computername%) from the .txt file and runs a remote job on that computer. This job has to run once, so now I'am looking for a command that can remove the line (%computername%) from the .txt file.

Can somebody please help me.

Thanx.....

Top
#123871 - 2004-07-26 10:20 AM Re: The opposite of writeline
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
opposite of writeline is readline.
if you want to update a file, you need them both.
readline&writeline used together does file updating.

so, what it actually means is copying the context to other file instead the part you don't want there.
_________________________
!

download KiXnet

Top
#123872 - 2004-07-26 10:38 AM Re: The opposite of writeline
Richard_Drahcir Offline
Lurker

Registered: 2004-07-26
Posts: 3
I've already tried that solution, but the original .txt file wil be merged about every second.
If the second script is reading the line than runs the job and after that it makes a new .txt file, I'll lost some data from the original .txt file.

Maybe I can first copy the original file, than follow the script, and the next time I run the script I first have to merge the original file to the new file.

On this way it will work, but I rather have a "removeline" option or something like that.

Grttz...
Richard

Top
#123873 - 2004-07-26 11:04 AM Re: The opposite of writeline
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is no such options.
there are tools renamed like it, but they do exactly the same or at least lock the file for random access while to remove stuff in the memory and put the modified file back.
so, in any case, you will always loose some info from the original file as it gets that often updated.
_________________________
!

download KiXnet

Top
#123874 - 2004-07-26 11:35 AM Re: The opposite of writeline
Richard_Drahcir Offline
Lurker

Registered: 2004-07-26
Posts: 3
Okay,

Thanks a lot...

Greetz Richard.

Top
#123875 - 2004-07-26 02:54 PM Re: The opposite of writeline
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Richard,

Why are you not using @WKSTA that is inbuild to KiXtart? While %COMPUTERNAME% will work, there are quite a few macros that are available from KiXtart.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#123876 - 2004-07-26 07:29 PM Re: The opposite of writeline
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Instaed of using WriteLine() with flat text files, you should use WriteProfileString() with INI files. That will let you add remove or update individual lines.
_________________________
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
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.031 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