I want to run some code (a clock) as soon as the program starts (ie not have to have a button pressed for the code to start). Is there a way to do this?
Thanks
How to run code on start up
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: How to run code on start up
You could put the code in an openStack or preOpenStack script in a stack script.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- Posts: 21
- Joined: Sat Jun 22, 2013 9:36 pm
Re: How to run code on start up
Thanks for your reply!
I now have this code and it keeps flashing between internet date and item 5 of internet date (the time)
I'm not sure how to fix this. Is there a way?
I now have this code and it keeps flashing between internet date and item 5 of internet date (the time)
Code: Select all
on preOpenStack
set the flag of me to not the flag of me
if the flag of me then startTimer
end preOpenStack
on startTimer
set itemDelimiter to " "
put item 5 of internet date into me
if the flag of me then send startTimer to me in 0.5 second
end startTimer
Re: How to run code on start up
Hi Rory,
I just put all of this into a stack script;
It worked fine for me, LiveCode 7.1 Win 7
I will say that there was a recent post in which the coder stated that running a script like this all day would end up I think 2 minutes off at the end of the day. It took stopping the timer and restarting it to sync up.
Simon
I just put all of this into a stack script;
Code: Select all
on preOpenStack
set the flag of me to not the flag of me
if the flag of me then startTimer
end preOpenStack
on startTimer
set itemDelimiter to " "
put item 5 of internet date
if the flag of me then send startTimer to me in 0.5 second
end startTimer
on mouseUp
preOpenStack
end mouseUp
I will say that there was a recent post in which the coder stated that running a script like this all day would end up I think 2 minutes off at the end of the day. It took stopping the timer and restarting it to sync up.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!