Sarah's scheduleMessage script.
Andrew Kluthe
andrew at rjdfarm.com
Wed Jul 21 18:33:50 EDT 2010
Hey there!
I always forget to turn my p2p software on before I go to bed at night and I
have oodles of *legal* downloads that I need to catch up on. So, I decided
to try to make a simple timer that would open a program at a certain time
and close it again at a certain time everyday.
I came across Sarah Reichelt's scheduleMessage script on this list.
The problem I am having is, the messages get queued but they never disappear
from the pending messages queue and they never call the handlers I need. It
lets me know they are scheduled at correct times and I can see the messages
in the queue. Why aren't they executing?
the handlers for open and closing the program work just fine. They just
don't execute when they are supposed to.
I have included the entire script here for testing purposes:
on openUTorrent
launch "C:/Program Files/uTorrent/uTorrent.exe"
end openUTorrent
on closeUTorrent
set the hideConsoleWindows to true
get shell("taskkill /IM uTorrent.exe")
end closeUTorrent
on setTimer
scheduleMessage "openUTorrent", 17, 20
scheduleMessage "closeUTorrent", 17, 23
end setTimer
command scheduleMessage pMessage, pHours, pMins
-- pHours is in 24 hour time
put the seconds into nextTime
convert nextTime to dateItems
put item 4 of nextTime into tHourNow
put item 5 of nextTime into tMinsNow
if tHourNow > pHours or (tHourNow = pHours and tMinsNow >= pMins)
then add 1 to item 3 of nextTime
put pHours into item 4 of nextTime
put pMins into item 5 of nextTime
put 0 into item 6 of nextTime
convert nextTime to seconds
send pMessage to this stack in nextTime seconds
-- Uncomment these lines for testing:
convert nextTime to short system date and long time
answer pMessage & " scheduled for " & nextTime
end scheduleMessage
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Sarah-s-scheduleMessage-script-tp2297880p2297880.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list