Jump to content
Sign in to follow this  
Somerset

file in use

Recommended Posts

Somerset

$a=1
while 1
$file = FileOpen("1.txt", 0)
While 1
$line = FileReadLine($file,$a)
If @error = -1 Then ExitLoop
;using this section as a way to escape from reading
;
$result = StringInStr($line, "Compressor:",1)
if $result = 5 then call("teminate")
;
ToolTip($line)
sleep(10)
$a=$a+1
Wend
FileClose($file)
wend
func teminate()
exit
endfunc

i am using the above code to read a text file that is being used and constantly being updated. the stringinstr is what i am using to exit from reading when it has reached the end of the updated file. this is real time showing of the file. that is why it loops.

i am suspecting that it can be rewritten with fileopen in write mode with an error check, but for me doing that myself has illuded me because i am sleepy.


 

Spoiler

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×