This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Run Scheduled script via script
#1
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?
Reply
#2
Why don't you just create event script and control it via normal Scheduler? You can then trigger such script any time you want.
------------------------------
Ctrl+F5
Reply
#3
(06.11.2024, 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.
Reply
#4
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.
------------------------------
Ctrl+F5
Reply


Forum Jump: