Repeating events

Bill Vlahos bvlahos at mac.com
Tue Dec 2 01:03:30 EST 2003


I have a script that I want to run every day at 5:00 AM and 2:30 PM and 
am having the hardest time figuring out how to work simply and 
reliably. The following script will figure out how many seconds from 
some arbitrary time to the next 5:00 AM. Normally the script will run 
automatically but it will be possible that the user might run it 
manually at any time.

convert the short time to dateItems
add 1 to item 3 of it -- tomorrow
put 5 into item 4 of it -- 5 AM
put 0 into item 5 of it -- :00 seconds
convert it to seconds
put it into vNextTime
convert the time to seconds -- current time
put it into vNow
put vNextTime - vNow into vTimeOffset -- number of seconds until the 
next 5:00 AM

This works OK for one repeating time per day but I want more than one 
(at this point it is two but it would be good to make a general case 
for any number of times the script is to be run).

Is there a simple way to track multiple repeating events without going 
bonkers keeping track of multiple send in times? I think I must be 
trying too hard on this but I can't think of a simple way to do it.

Bill



More information about the use-livecode mailing list