how to make things happen at specific times

Sarah Reichelt sarah.reichelt at gmail.com
Wed Apr 8 07:27:32 EDT 2009


On Wed, Apr 8, 2009 at 6:00 PM, Peter Alcibiades
<palcibiades-first at yahoo.co.uk> wrote:
>
> Sarah, thanks!  The thing that still puzzles me is this.  They come in and
> start up the stack.  They may do this every day, or they may leave it
> running for a few days.  Every day at 4pm it should send an email.
>
> So yes, you could check the time when the stack is started, subtract the
> time from 4pm, and then wait that number of seconds.  But what happens the
> next day at 4pm?
>
> AHA,HE SEES IT!
>
> You need a loop.  First on startup find the time to 4pm.  Then what happens
> at 4pm is to send the email, wait a couple of hours, and invoke the 4pm
> script again....  Yes, it should do it.  Thanks.
>

That's it :-)

For apps where I have a lot of these messages in the pendingMessages
queue, I make a checkMessages handler that gets called more
frequently. It checks all the required pending messages and if one is
missing from the list, it sets it up again at the appropriate time.

Cheers,
Sarah



More information about the use-livecode mailing list