script on timer?

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

script on timer?

Post by DavJans » Wed Feb 12, 2014 12:30 am

is there a way to run a set of code every minute without any user interaction when on a specific card?

like onMouseup but on5minuteinterval
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: script on timer?

Post by dave.kilroy » Wed Feb 12, 2014 12:55 am

There are lots of ways of doing this, such as, in the script of the card of your choice:

Code: Select all

local sKeepRepeating

on openCard
    --set up the script variable to control whether the handler can be stopped later on
    put true into sKeepRepeating
    
    --make the first call to repeatingHandler
    repeatingHandler
close openCard

on repeatingHandler
    --if the script variable is true then proceed
    --otherwise if it is false this handler runs through and is not called again
    if sKeepRepeating then
        --do some stuff 
        --if you wish to stop this handler being repeatedly called 
        --you can set sKeepRepeating to false here

        --this is the 'recursion' bit - where the handler calls itself
        send repeatingHandler to me in 5 seconds
    end if
close repeatingHandler
"...this is not the code you are looking for..."

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

Re: script on timer?

Post by DavJans » Wed Feb 12, 2014 1:11 am

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

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: script on timer?

Post by dave.kilroy » Wed Feb 12, 2014 1:15 am

A pleasure - and I'm sure others will chime in with other/better ways. What are you building?
"...this is not the code you are looking for..."

Post Reply