I think I may not have been very clear.

This isn't LiveCode doing anything special; just a standalone LiveCode app that either does something immediately on launch (and then quits), or inspects the command line parameters to decide what to do (and then quits).

I usually create a .bat file (on Windows) or .sh file (on Mac/Linux) to run the LC app with the appropriate parameters.

On Windows you run the "Task Scheduler" and create a task to run the .bat file, with whatever schedules you like. On Mac/Linux you edit the 'crontab' file adding one or more lines with the interesting syntax to execute the .sh file.

Your app can read the command line parameters (on Mac/Linux or Windows) by inspecting the special global variables $0, $1 etc.

The only gotcha is that on Mac, you think your app is at e.g.
 /Users/yourname/Myapp

- but actually on Mac what appears to be an application "Myapp" is a bundle (i.e. a folder with a special flag so the Finder pretends it's not), and the path to the executable app is e.g.
 /Users/yourname/Myapp.app/Contents/MacOS/Myapp

On Linux and Windows, it's where you think it is!

Ben

On 12/07/2022 15:56, Bob Sneidar via use-livecode wrote:
It seems to me that if you have an open socket to listen for commands, you 
could have the chron or windows scheduler send those commands to your LC app.

Ben, some syntax would be helpful.

Bob S


On Jul 12, 2022, at 07:48 , Ben Rubinstein via use-livecode 
<use-livecode@lists.runrev.com> wrote:

Hi Tim,

On 11/07/2022 12:35, Tim Selander via use-livecode wrote:
I want to have an LC app running on a computer doing nothing but watching the 
time. At predetermined times, I then want it to run a command. A call to an API 
on a website.

My $0.02, FWIW: it this is really all your app is doing, and the times are 
every fee hours or days, rather than every few seconds, I would use the 
computer's built in scheduler to invoke your app, rather than have it running 
continuously and watching the time.

I have a number of things like this - LC apps which are launched by schedule. 
On Windows, the Windows scheduler (I generally use a batch script which 
launches the app in this case); on Mac or Linux, use cron. I find this more 
reliable, easier to update etc.

Ben


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to