Repeating events

Sarah sarahr at genesearch.com.au
Tue Dec 2 17:03:41 EST 2003


Hi Bill,

You have already received some good advice here, but having done quite 
a lot of this sort of thing, here is some extra advice:
- store the script run times in 24 hour format - that makes it much 
easier to handle the transition to the following day.
- have a routine that is called on startup or openStack that sets the 
next script run time and sends the message. If this makes sure to 
cancel any pending messages to your script, it can be run whenever you 
might be doubtful about the message.
- after the script has run, call this routine again to set the 
following one, making sure that it doesn't set it for it's own minute 
again.
- ALWAYS check for left-over messages so that you aren't getting 
multiple sends to the same script.

I have a set of standard message sending scripts I use:
	cancelMessageName	-- cancels all messages with the specified name
	cancelMessageID		-- cancels all messages with the specified id
	setupNextCall		-- cancels messages then sends a new one
	sendMessageAt		-- sends a message at a particular time

If you are interested, let me know and I can send you them off-list.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/

On 2 Dec 2003, at 4:05 pm, Bill Vlahos wrote:

> 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
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>



More information about the use-livecode mailing list