Topic 1.2.1 – Overview

About Active Event

ActiveEvent is an ActiveX control that notifies the event system when an event occurs in another application, such as a deployed object in your Galaxy. ActiveEvent is script-based and you can use it in any application that supports a COM-enabled scripting language to detect an event for that application. COM-enabled scripting languages include InTouch scripting and Visual Basic.
To enable external event detection for Historian Server, you must:

  1. Create an event tag in Historian Server to store the event occurrence information. Make sure that the detection type is set to External.
  2. Import the Active Event ActiveX script library aahActiveEvent.dll into the Galaxy so you will have all methods and properties available for scripting.
  3. The Historian Server installation program allows you to install some of the features of the system separately. The ActiveEvent feature should be installed where the object running the Active Event script is deployed.
  4. Write a script that notifies the Historian Server event system of the external event.
 
Scripting ActiveEvent

Use the ActiveEvent methods in scripts to connect to a Historian Server and detect an external event. An external detector is triggered using Historian Server ActiveEvent control. The ActiveEvent control (which resides on a client machine) interacts with the event detector (which resides on the server machine) in order to trigger events externally. The ActiveEvent control facilitates the remote triggering of events on Historian Server by first initializing with Historian Server computer name and event tag, and then calling the Invoke Event Ex() method.
You can script an ActiveEvent using any scripting language that supports COM. For example, you could trigger an event from a Visual Basic script.
Add EventTag()
Adds an event tag to the active event tag list.
 

Method

AddEventTag(string EventTag)

Parameter

EventTag

Name of the event tag with which the ActiveEvent event detector is associated. ActiveEvent is used with an external type event detector.

Returns Value

0 = Success

2 = Unable to execute method because ActiveEvent is not initialized 7 = Remote function call failed


InitializeEx()
Creates a connection to Historian Server.
 

Method

InitializeEx(string ComputerName)

Parameter

ComputerName

Name of the computer on which Historian Server is running. If you are not connecting to Historian Server over a network, use a blank string ("") for the computer name.

Note: You cannot use a Historian Server alias for this parameter.

Returns Value

0 = Success

1 = Unknown failure

3 = Unable to initialize ActiveEvent 4 = ActiveEvent is already initialized 7 = Remote function call failed

8 = Unable to determine local computer name

Remarks

Once you have initialized with a Historian Server, use the IsConnected property to determine if the connection was successful. Also, you only need to initialize with the server once. You can invoke an unlimited number of events after initialization has occurred.

If you are using InTouch, initialization will not occur unless the ActiveEvent ActiveX control is part of an open window. This limits the use of the InvokeEventEx method within InTouch Application Scripts, Condition Scripts, Data Change Scripts, and so on. When you close an InTouch window, all ActiveX controls are automatically uninstantiated.


InvokeEventEx()
Triggers the event at the time this method is called.
 

Method

InvokeEventEx(string EventTag)

Parameter

EventTag

Name of the event tag with which the ActiveEvent event detector is associated. ActiveEvent is used with an external type event detector.

Returns Value

0 = Success

1 = Unknown failure

2 = Unable to execute method because ActiveEvent is not initialized 7 = Remote function call failed

Remarks

You can invoke an unlimited number of events after you initialize with Historian Server.


InvokeEventAtTimeEx()
Triggers the event at a specified date/time.
 

Method

InvokeEventAtTimeEx(string TagName, string EventDateTime)

Parameter

TagName

Name of the event tag with which the ActiveEvent event detector is associated. ActiveEvent is used with an external type event detector.

EventDateTime

Date/time that you want the event triggered. This date is in local time for Historian Server. The event date and time must be formatted as:

YYYY-MM-DD hh:mi:ss.mmm

Returns Value

0 = Success

1 = Unknown failure

2 = Unable to execute method because ActiveEvent is not initialized 5 = Unable to perform date/time conversion due to invalid format

6 = Date/time cannot be a future date 7 = Remote function call failed

Remarks

You can invoke an unlimited number of events after you initialize with Historian Server.



Last modified: Monday, 24 June 2019, 11:16 AM