The Python class Scheduler gives access to the integrated scheduler component.
These events are available via Python event handlers:
- ScheduledEvent(EventName,Command)
- Error(Id,EventName,Description)
If the Python event handler for ScheduledEvent returns 0 Scorpion
will execute default handling for the event, if the Python event handler
returns 1 the event will be ignored by Scorpion.
Note ! Any changes to the component configuration will be persistent. If
these settings is temporarely the script must retrieve the origin settings
before setting new values and finally restore origin settings when done.
The following methods are available for the Scheduler class in any Python script :
Method |
Parameters |
Comment |
IsEvent(name) |
string |
sends a TDVCMD formatted string |
SetEventActive(name,active) |
string, int |
activates/deactivates named event |
IsEventActive(name) |
string |
returns 0 or 1 due to current state of named
event |
ExecuteEvent(name) |
string |
executes named event (don't care of Active state) |
Example, execute some events due to state (from Python):
if Scheduler.IsEventActive('start')<>0:
#check state of event
Scheduler.ExecuteEvent('start')
#execute the event
Scheduler.SetEventActive('start',0) #deactivate the
'start' event
else:
Scheduler.ExecuteEvent('stop')
#execute another event
Scheduler.SetEventActive('start',1) #activate the
'start' event |