Time trigger or Scheduled task?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Time trigger or Scheduled task?

Post by DavJans » Wed Apr 20, 2016 11:19 pm

I need my app to do something at midnight every week day, should I wright my app like this:

on openStack
do stuff
clsoe stack
end openStack

And have windows use scheduled task to run my app at midnight.

Or,

Is there a way in live code to check the time and when time = 0:00:00, then do stuff?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Time trigger or Scheduled task?

Post by dunbarx » Wed Apr 20, 2016 11:49 pm

Hi.

Simple to make a stack that can live forever, whether or not LC is in front or not

On a new card, make a button and a field. Put this into the button script:

Code: Select all

on mouseUp
   findMidnight
end mouseUp

on findMidNight
  if the long  time = "12:00:00 AM" then 
      put the long time & return after field 1
      wait 2 seconds
   end if
   send "findMidNight" to me in 30
end findMidNight
Now I suggest that for testing you change the time to something you can play with. And instead of just putting that time into the field, you can do something else. This will not interfere with any other LC process, and it will work regardless of what else you are doing on your computer.

Craig NEwman

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Time trigger or Scheduled task?

Post by DavJans » Thu Apr 21, 2016 7:02 pm

Thank you, works beautifully.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Post Reply