Execution of a "long" script

JB sundown at pacifier.com
Mon Aug 11 17:17:56 EDT 2014


That is some really good information.

thanks,
John Balgenorth


On Aug 11, 2014, at 11:18 AM, kee nethery <kee at kagi.com> wrote:

> I have a bunch of long running scripts. I structure them so that they pause between cycles. By that I mean, if I am processing a bunch of files, I might have a field where I list all the files and then I trigger a script that processes the first unprocessed file in the list. When there are no unprocessed files, it halts because it is done.
> 
> When a file is processed, I mark it in the list and then the very next thing I do is send a message in (for example) 5 seconds, to run that script again. For that 5 seconds nothing happens and presumably “things” reset to an idle state before going after the next file. It keeps doing this until all the files are processed.
> 
> I have scripts that essentially run for weeks at a time.
> 
> The one feature I add into all my scripts is a safe exit from whatever it is doing. Within all my loops I have:
> 
> if optionkey is down then
>   exit repeat
> end if
> 
> I put these all throughout my code so that if I need to halt, it does so safely. In the file example, perhaps in a beginning section I just exit out of the script. Perhaps in a section after an hour of processing, I let it finish and then don’t trigger the send message in 5 seconds to do it again.
> 
> Finally, In long running scripts I find it is essential to provide a visual indication of where the script is. I try to have something in the interface change more frequently than once a minute so that I know it is still running and not lost in some loop. Plus, if it stays with some indicator for a really long period of time, I know that is where I need to add a debug statement and figure out why it is taking so long there.
> 
> Kee Nethery
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list