What is the best way to trigger an action at a certain time?
bobsneidar at iotecdigital.com
Mon Jul 11 11:27:09 EDT 2022
constant cInterval = 300
put cInterval into lInterval
-- your code
send checkTime to me in lInterval seconds
setProp interval, pInterval
if pInterval is empty then
ask "Enter a time interval in seconds:" as sheet
if the result is not "Cancel" and it is an integer and it >0 then \
put it into lInterval
put pInterval into lInterval
> On Jul 11, 2022, at 04:43 , Tore Nilsen via use-livecode <use-livecode at lists.runrev.com> wrote:
> For this I would use a recursive approach with «send in time» something like this:
> on openStack
> end openStack
> on checkTime
> ## Do your routines of checking time, performing the required action etc.
> send checkTime to me in 300 seconds. ## you set the interval to whatever is best for you
> end checkTime
> Best regards
> Tore Nilsen
>> 11. jul. 2022 kl. 13:35 skrev Tim Selander via use-livecode <use-livecode at lists.runrev.com>:
>> Dear all,
>> I want to have an LC app running on a computer doing nothing but watching the time. At predetermined times, I then want it to run a command. A call to an API on a website.
>> In the old HC days, I remember using "on idle" to watch for a set time. But even then, using "on idle" was less than ideal. CPU hog. What is the preferred/LC way to have an app trigger a command at a specific time of day?
>> Any pointers appreciated!
>> Tim Selander
>> Tokyo, Japan
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode