Timed Execution of a Script (second time lucky?)
Cubist at aol.com
Cubist at aol.com
Fri Mar 18 17:24:33 EST 2005
sez gregory.lypny at videotron.ca:
>I'm playing with Revolution as a CGI engine with the scripts in stacks.
>
> I'm wondering if there's a way to have Revolution executive a script
>at specified intervals, for example, every Tuesday night at ten
>o'clock.
>
>Any thoughts?
Sure. The basic idea is pretty simple:
on openStack # or whatever other trigger you like
...
send ("TimedScript" && 86400) to me in 3600 seconds
...
end openStack
on TimedScript TheInterval
DoAllKindsaStuffHere
send ("TimedScript" && TheInterval) to me in TheInterval seconds
end TimedScript
Of course, this kinda assumes that your machine will NEVER crash or go
offline. Not what you'd call a realistic assumption. Therefore, a better idea
would be to figure out when you want "TimedScript" to run the first time, and how
often it should run thereafter (you're likely to find the dateItems time/date
format helpful here); write that information to a text file on disc; and
every time the program is run, it reads that text file & uses that information.
In short: The key is "send TheMessage to me in XXX seconds". The rest --
figuring out what value to use for XXX -- is up to you.
Hope this helps...
More information about the use-livecode
mailing list