repeating time in field

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

repeating time in field

Post by KennyR »

Is there a way to create a loop or repeat function that continuously updates the current time in a field? I have been trying to make this work with something like below:

on preOpenCard
repeat forever
put the time into fld "time"

if fld "time" is "12:00 PM" then

answer "Blah blah blah"

else
end if
end repeat
end preOpenCard

--But this just either loops the blank screen until a condition is met, or it will not put the time in the "time" field....I would like to have the loop check the time until a certain time is met then send a msg to the user, then keep looping until that time is met once again...and so on.....

thanks for the help
Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: repeating time in field

Post by Dixie »

You could use something like this...

Code: Select all

on openCard
   setTime
end openCard

on setTime
   put the seconds into tempTime
   
   -- if tempTime = whatever then
   -- do whatever
   -- end if
   
   convert tempTime to long time
   put tempTime into fld 1
   send "setTime" to me in 1 second
end setTime

You will have to juggle with the seconds, but this should get you started

be well

Dixie
KennyR
Posts: 256
Joined: Thu Jan 19, 2012 4:25 am

Re: repeating time in field

Post by KennyR »

Thank you Dixie for taking the time to help! Im going to try this code out now...have a great week...
Post Reply