Promotic

onStep - event of the PmaSequencer object

Description:
The event is triggered when the item is released.
Parameters:
pMe(Object) Reference to the PmaSequencer object where the event rises.
pEvent(Object) Reference to object describing detailed information about the specific event.
pEvent.ReleaseType - (Long) [for reading] Cause of the item release:
0 - the item didn't wait, i.e. the timeout=0 in the Add method
1 - the item was waiting and the timeout has expired
2 - the item was waiting and the Release method has been called
pEvent.ReleaseCancel - (Boolean) [for read and write] The default value is false.
If set to true, then the item continues to wait (only if the event is triggered by calling the Release method, i.e. if pEvent.ReleaseType=2).
pEvent.Val1 - (Variant) [for reading] 1st value of the item.
pEvent.Val2 - (Variant) [for reading] 2nd value of the item.
pEvent.Val3 - (Variant) [for reading] 3rd value of the item.
Note:
The event is triggered either in the main thread or in the worker thread. The usage of both threads is entered in the "Used thread" configurator by the Params parameter of the Add method.

Caution:
The PmaSequencer object is special because its the onStep event is triggered in main or working thread ("thread:work;" or "thread:main;"). Therefore the methods were doubled internally and then compiled in both: in the main thread and in the worker thread. If the method is called from the working thread, then it is executed in this thread. In other cases it is executed in the main thread (as other object methods are).
This allows easy creation of auxiliary functions making the onStep event itself much better arranged. Even if the onStep event is called alternatively in main and working thread the method is then called automatically in the corresponding thread.
Example1:
The scripts representing operations "A", "B" a "C" will be executed every 2 seconds.
JavaScriptVBScriptSelect and copy to clipboard

switch (pEvent.Val1)
{
case "A":
// Execute the operation A
pMe.Add(2, "B", 1);
break;
case "B":
// Execute the operation B
pMe.Add(2, "C", 1);
break;
case "C":
// Execute the operation C
pMe.Add(2, "A", 1);
break;
}
PROMOTIC 9.0.21 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.