Page 1 of 1

Open Certain file schedule

Posted: Thu Apr 20, 2017 9:42 pm
by Kulcanhez
Hello everyone,
I'm learning LiveCode, I know LiveCode for some time but just now I'm learning it.
I'm developing a simple app for desktop that open a certain file at time the user want. Just a simple interface that the user choose the file and the time, and when reach that time it open the file. How can I do this?
Thank you very much!

Re: Open Certain file schedule

Posted: Thu Apr 20, 2017 10:32 pm
by Klaus
Hi Kulcanhez,

welcome to the forum! :D

Out of my head, something like this:
1. convert the user selected time to seconds -> userTime
2. convert the current time to seconds -> tNow
3.

Code: Select all

...
send "launch_user_file" to this stack in userTime - tNow seconds
## or top wherever you store the command, see below
...

Code: Select all

## Put this e.g. into stack script
command launch_user_file tUserSelectedFile
  launch document tUserSelectedFIle
end launch_user_file
You get the picture. :D

Hint:
The app has to be open all the time or this will not work!


Best

Klaus

Re: Open Certain file schedule

Posted: Thu Apr 20, 2017 10:56 pm
by dunbarx
Here is another way, that you may find fun to play with. In a button script:

Code: Select all

on mouseUp
   ask "Enter start time"
setTime it
end mouseUp

on setTime tStartTime
   if the optionKey is down then exit to top
   if the time = tStartTime then
      Beep 3
      answer "Right NOW!"
      exit to top
   end if
   send "setTime" && tStartTime to me in 5
end setTime
You can stop this at any time by pressing the optionKey, and you can do any other task while it is running. The way it is written, at least in the US, you would enter something like "6:15 PM". But this can be modified in many ways.

Craig Newman

Re: Open Certain file schedule

Posted: Fri Apr 21, 2017 7:37 am
by Kulcanhez
Thank you very much I will try :)