LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
I'm having an interesting challenge, at least for my standards of transcript knowledge. I want to poll in realtime (or at least refresh every 2 seconds or so) the contents of a file and display them in a scrolling field.
repeat while condition="true"
read from file mypath&"/somefile.txt" at -1000 until EOF
put it into field "info_field"
end repeat
the program locks up (note that there is a button that when pressed "condition" should have the value "false") and there is nothing I can do but restart Revolution.
on startTimer
read from file mypath&"/somefile.txt" at -1000 until EOF
put it into field "info_field"
if condition=true then send "startTimer" to me in 2 seconds
end startTimer
PS: To get out of the repeat loop, try command + period.
1. Use parenthesis for concatenating strings, especially for filepaths and object names!
Someties the engine gets confused without them...
-> read from file (mypath & "/somefile.txt")...
-> put empty into field ("fieldname" & var_number)
-> hide button (var_buttonname & "2")
2. If you want to read from a file you have to open it first and cose it after use!
Try this:
on startTimer
open file (mypath & "/somefile.txt") for READ
read from file (mypath & "/somefile.txt") at -1000 until EOF
close file (mypath & "/somefile.txt")
put it into field "info_field"
if condition = true then
send "startTimer" to me in 2 seconds
end if
end startTimer