Fixed-time timers problem-help!
Scott Rossi
scott at tactilemedia.com
Sat May 10 16:09:01 EDT 2003
"Bryan McCormick" <bryan at deepfoo.com> wrote:
> I have a stack that needs to run itself at set times of
> the day. The intervals are large and fixed, that is there is a specific
> clock time involved, not just an interval.
>
> For example, I need the stack to be aware of the time of day when it
> opens and initialize itself. That part is easy.
>
> Then I need the stack to send out a request for data every half hour
> through a simple script which is working fine, so all we need is the
> timer. So that is on the half-hour and hour as follows:
>
> 9, 9:30,10, 10:30, ... all the way to 4PM.
>
> Now, the problem is "send" works great in cases where you need to
> "poll" on a regular basis or for event contro where you don't want to
> use idlel. However I don't need that at all. Ideally I would want to
> create 13 messages (13 half-hour intervals with set times) to start the
> script.
Actually, if I understand your post, you do need this. The following script
checks the time once each minute. Alternatively, you could check the time
at startup, do some math to calculate the offset to the next half hour, send
whatever message is needed when the interval is done, and then send all
future messages every 30 minutes.
on mouseUp
set the twelveHourTime to false
runTimer
end mouseUp
on runTimer
set itemDel to ":"
if item 1 of the time > 8 and item 1 of the time < 16 then
if item 2 of the time is in "00,30" then
ask "Please enter your data:"
# callSpecialHandler it
end if
end if
send "runTimer" to me in 60 seconds
end runTimer
Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com
More information about the use-livecode
mailing list