Slight improvement:
local lInterval
constant cInterval = 300
on openStack
put cInterval into lInterval
checkTime
end openStack
on checkTime
-- your code
send checkTime to me in lInterval seconds
end checkTime
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
else
put pInterval into lInterval
end if
end interval
Bob S
> On Jul 11, 2022, at 04:43 , Tore Nilsen via use-livecode
> <[email protected]> wrote:
>
> For this I would use a recursive approach with «send in time» something like
> this:
>
> on openStack
> checkTime
> 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
>> <[email protected]>:
>>
>> 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
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode