Display Status of a Repeat Loop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Display Status of a Repeat Loop
Hello,
Just got on board with LiveCode recently, previous a MetaCard guy. Here's my issue. In a repeat loop, I used to put a running count into a field so I could see the progress of the script. This does not work in LiveCode so I'm looking for a workaround.
Example:
repeat with i = 1 to 1000
-- do some action here
put i into field "status"
end repeat
When run, the field "status" would flash the numbers going by and I could see how far the script was. Now it does not. Instead of 1000, picture the number of lines in a 15 MB text file - like 70 thousand lines or so. I'd like to be able to see where I am in the process while the script runs. Best workaround/idea?
Just got on board with LiveCode recently, previous a MetaCard guy. Here's my issue. In a repeat loop, I used to put a running count into a field so I could see the progress of the script. This does not work in LiveCode so I'm looking for a workaround.
Example:
repeat with i = 1 to 1000
-- do some action here
put i into field "status"
end repeat
When run, the field "status" would flash the numbers going by and I could see how far the script was. Now it does not. Instead of 1000, picture the number of lines in a 15 MB text file - like 70 thousand lines or so. I'd like to be able to see where I am in the process while the script runs. Best workaround/idea?
Re: Display Status of a Repeat Loop
Hi Richard,
you need to give the app a little (very little indeed
) time to update the screen:
...
repeat with i = 1 to 1000
-- do some action here
put i into field "status"
wait 0 with messages
## as I said VERY little time
end repeat
...
That should do the trick.
Best
Klaus
P.S.
MetaCard still works with the LiveCode engine!
you need to give the app a little (very little indeed

...
repeat with i = 1 to 1000
-- do some action here
put i into field "status"
wait 0 with messages
## as I said VERY little time

end repeat
...
That should do the trick.
Best
Klaus
P.S.
MetaCard still works with the LiveCode engine!

Re: Display Status of a Repeat Loop
Addendum!
Since displaying something in a field during a repeat loop will slow down performance heavily,
you should not display EVERY number in the field. Better only display every 100th or even 1000th number!
You get the picture!
Best
Klaus
Since displaying something in a field during a repeat loop will slow down performance heavily,
you should not display EVERY number in the field. Better only display every 100th or even 1000th number!
Code: Select all
...
repeat with i = 1 to 1000
-- do some action here
if i mod 100 = 0 then
put i into field "status"
end if
end repeat
...
Best
Klaus
Re: Display Status of a Repeat Loop
Caramba!
Klaus is so fast
Yes it work and the addendum is useful
Jean-Marc
Klaus is so fast

Yes it work and the addendum is useful
Jean-Marc
https://alternatic.ch
Re: Display Status of a Repeat Loop
Yep, call me "Speedy Gonzales"! 

-
- Livecode Opensource Backer
- Posts: 211
- Joined: Sun Oct 24, 2010 12:13 am
Re: Display Status of a Repeat Loop
Awesome! Will implement immediately. Thanks for the help - I really appreciate it.