Logic Machine Forum
Run Scheduled script via script - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Run Scheduled script via script (/showthread.php?tid=5722)



Run Scheduled script via script - Fahd - 06.11.2024

Hi,

I'm controlling a scheduled script using a 1-bit object by enabling and disabling the script. How can I run the script immediately after turning it on without copying the entire script into an event-based script?


RE: Run Scheduled script via script - Daniel - 06.11.2024

Why don't you just create event script and control it via normal Scheduler? You can then trigger such script any time you want.


RE: Run Scheduled script via script - Fahd - 07.11.2024

(Yesterday, 12:33)Daniel Wrote: Why don't you just create event script and control it via normal Scheduler? You can then trigger such script any time you want.

The schedule script needs to run every hour to compare the electricity price of the current hour with the average cost for the day, and then control a PLC based on this comparison. We also want to be able to enable or disable this script from the BMS system when it’s not needed. To achieve this, a 1-bit object with
Code:
script.disable/enable
functionality has been used. However, when we enable the script via this object, it doesn’t run immediately; it only starts at the next scheduled time.
I was wondering if there’s a command like
Code:
script.run()
to trigger the script immediately upon enabling.


RE: Run Scheduled script via script - Daniel - 07.11.2024

Well you can do exactly the same with scheduled script combined with event. The script itself would be in event script and the scheduled script would just writ a value to event trier object to to run it. While enabling scheduled script just write value to event trier object to start it.