Run Script at Specific Times?

I would like to be able to trigger a script to run at specific times e.g. on the hour or at 15, 30, 45 and 0 minutes past the hour, or once a day at 0900. I’d like the trigger to run indefinitely until disabled.

I can see there are Timer scripts within Ignition, but the timing of these is rate based, which does not guarantee the absolute time at which the script will execute.
Is there a way to execute scripts at a specific time within Ignition, or a way to trigger externally with (for example) Windows Task Scheduler? Thanks.

You could put this in a Gateway Timer script that executes every 1000ms

[code]from time import localtime, strftime

curTime = strftime("%H:%M:%S", localtime())

if curTime == “00:00:01”:
yourScript()

if curTime == “06:00:00”:
yourScript2()[/code]

1 Like

Hi!

Other things you can try:

Option 1
You can create an expression tag, with the expression tailor made for your trigger. For example, this will be true at 0, 15, 30, and 45 minutes of the hour:

(getMinute(now())) = 0  ||
(getMinute(now())) = 15 ||
(getMinute(now())) = 30 ||
(getMinute(now())) = 45

Then, in the Tag Events section, use a Value Changed script:

Option 2
Same expression tag, but use it in a Gateway Tag Change Script

One thing to keep in mind (because I’ve been bitten by it once or twice) is that while Gateway Event Scripts run on the gateway, the script is stored with the project. So if you have multiple projects, you’ll need to pay attention to which project you put it in.

Or, in Leo Beiser’s First Computer Axiom, “When putting it into memory, remember where you put it.”

Thanks for the suggestions!

Would it be possible to re-post the images so that they display here?

Done. :slight_smile:

I know this is old, but in case somebody has the question and comes across this, as of version 8.1.6 there is a Gateway Event Scheduled Timer, which is absolute. It has a nice interface and shows you the equivalent unix crontab settings as you set it up.

1 Like