ActiveEvent methods
- Last UpdatedMar 07, 2025
- 1 minute read
Use ActiveEvent's methods in scripts to connect to an AVEVA Historian and trigger an event. The ActiveEvent control aids the remote triggering of events on the Historian by first initializing with the Historian computer name and event tag, and then calling the InvokeEventEx() method.
ActiveEvent can be scripted using any scripting language that supports COM. For example, an InTouch script can trigger an AVEVA Historian event if you use this control in an InTouch application. You can also trigger an event from a Visual Basic script.
Note: ActiveEvent does not work in asynchronous mode in an InTouch application.
The following example InTouch script connects to a server named "WWHistorianServer1," adds the event tag called "ExternalEvent," and logs an "ExternalEvent" event tag event.
{ Connect ActiveEvent to your AVEVA Historian--only needs to be done once.}
intResult = #WWHistEvent1.InitializeEx( "WWHistorianServer1");
{Was initialization successful or are we already initialized? }
IF intResult == 0 OR intResult == 4 THEN
intResult = #WWHistEvent1.AddEventTag("ExternalEvent");
IF intResult == 0 THEN
intResult = #WWHistEvent1.InvokeEventEx("ExternalEvent");
IF intResult == 0 THEN
sDisplayResult = "Logged event";
ELSE
sDisplayResult = "Failed to log event";
ENDIF;
ENDIF;
ENDIF;