Programming with Reflection

image\rwnprg32.gif OnEvent method

 

Syntax object.OnEvent EvNumber, Event, CommandType, Commands, Enable, AfterEvent, [String], [Row], [Column], [Key], [CommandArguments]

 

Description

Defines commands to be executed when a specified event occurs during a Reflection session. Events defined with this command are equivalent to events added using Reflection's Event Setup dialog box.

Arguments

EvNumber Argument type: Integer or Enumeration
Required
An index number that determines the location of this event on the list of defined events. Use 1 to add a new event to the top of the list. Use rcNextEvent to add the event to the end of the list. The EventDefined property returns the number of the most recently defined event.

 Note: If two or more items on the list of defined events are triggered by the same event, Reflection executes the commands in the order that the events appear in the list, starting with the event closest to the top of the list.

Event Argument type: Enumeration
Required
Identifies the event which will trigger the commands specified the Commands argument. The possible values are:

 rcSilence

 Defines an event as the absence of activity for the specified duration. By default inactivity means the absence of data from the host. You can set InactivityEventsIgnoreKeyboardMouse to False if you want keystrokes and mouse actions to restart the countdown.

 Use the String argument to specify an interval of time in HH:MM:SS.hh format.

 rcKbdEnabled

 Defines an event as the keyboard being unlocked for the specified duration. Use the String argument to specify an interval of time in HH:MM:SS.hh format.

 rcEvConnected

 A connection has been made to a host. If a connect macro is configured, this event will occur after the connect macro has executed.

 rcEvDisconnected

 Defines an event as a host connection becoming disconnected. If a disconnect macro is configured, this event will occur after the disconnect macro has executed.

 rcEnterPos

 Defines an event as the positioning of the cursor at the specified screen coordinates. Use the Row and Column arguments to specify coordinates. For the event to occur, the cursor must be at the specified coordinates. To specify any row or column, use the value rcAnyRow or rcAnyCol, but not both at the same time.

 rcExitPos

 Defines an event as the positioning of the cursor at any location on the screen other than specified coordinates. Use the Row and Column arguments to specify coordinates. For the event to occur, the cursor must have previously been at the specified coordinates, and now must not be at the specified coordinates. To specify any row or column, use the value rcAnyRow or rcAnyCol, but not both at the same time.

 rcCommString

 Defines an event as the reception of the specified string from the host. Use the String argument to specify the string.

 Note: When Event is rcCommString, you can use the Row argument to determine how characters received from the host are interpreted. Specifying rcNoTranslation for the Row argument prevents the event from translating the characters using Reflection's translation tables.

 rcDisplayString

 Defines an event as the specified string appearing at the specified coordinates in the terminal window. Use the String argument to specify the string. Use Row and Column to specify coordinates. To specify any row or column, use rcAnyRow and/or rcAnyCol for Row and Column.

 rcTimeOfDay

 Defines an event as the current time matching the specified clock time. Use the String argument to specify the time of day in HH:MM:SS.hh format using a 24-hour clock (00:00:00-23:59:59) or express time as an Automation Date/Time value.

 rcTime

 Defines an event as the passage of the specified amount of time from when the event is defined. Use the String argument to specify the interval of time in HH:MM:SS.hh format.

 rcTerminalKeystroke

 Defines an event as the transmission of the specified terminal key to the host. The Key argument defines the host function.

 rcReflectionStart

 This event occurs when you start Reflection. For this event to occur, you must save your settings file and use this settings file to start Reflection.

 rcReflectionExit

 This event occurs when you exit Reflection. This event occurs no matter how reflection is shut down. If Reflection is configured to Exit on Disconnect, this event occurs after this disconnect, and before Reflection goes away. If an On Exit command has been configured via RCL, this event will occur before the RCL command is executed. Any of the available methods, such as File, Exit, Quit, System Menu, will cause this event to occur. Note: You can define an action for this event using CancelExitEvent if you want to be able to cancel the exit.

 rcLoadSettingsFile

 This event occurs when you open a settings file. For this event to occur, the event must be configured, and then saved to a settings file. When you open this settings file, the event occurs after the settings have been loaded but before the connection is made (if the settings file is configured to make a connection).

 rcBlockModeEnter

 The terminal has entered block mode.

 rcBlockModeExit

 The terminal has exited block mode.

 rcFileTransferDone

 A file transfer has successfully completed.

CommandType Argument type: Enumeration
Required
Specifies what sort of command to attach to the event. The possible values are:

 rcBuiltInFunction

 Maps the event to one or more built-in functions.

 rcTransmitString

 Maps the event to a string that is transmitted to the host when the event occurs. The string is assumed to be in the Windows character set, and is translated into the appropriate host character set as it is transmitted. Note: Use the Commands argument to specify the string to transmit.

 rcVBCommand

 Maps the event to a single Visual Basic statement. This statement can include Visual Basic functions and statements and/or Reflection methods and properties. Use doubled quotation marks for string values within literal strings.

 rcVBMacro

 Maps the event to a Reflection macro. Use the Commands argument to specify the macro's name. You can pass additional information to the MacroData property using CommandArguments.

 rcRBCommand

 Maps the event to a single Reflection Basic statement.

 rcRBScript

 Maps the event to a Reflection Basic script. Use the Commands argument to specify the script's file name. Supply complete path information if the script isn't on the Reflection macro path. You can pass arguments to the script using the optional CommandArguments.

Commands Argument Type: String
Required
The action(s) to be taken when the event specified by the Event argument occurs. Depending on the value of CommandType this can be a built-in function, a string to transmit, a Visual Basic statement, a Reflection macro, a Reflection Basic script, an RCL command, or an RCL script.

Enable Argument type: Enumeration
Required
Specifies whether Event is enabled or disabled:

 rcEnable

 This event is enabled. If the event occurs, it will trigger the associated commands.

 rcDisable

 This event is not enabled. If the event occurs, it will not trigger the associated commands.

AfterEvent Argument type: Enumeration
Required
Specifies what happens after Event occurs:

 rcEventDisable

 After the event occurs, it is still defined, but is disabled. If the event occurs again, it will not trigger the associated commands. Events defined this way run once per session.

 rcEventReenable

 After the event occurs, it is still enabled. If the event occurs again, it continues to trigger the associated commands. Events defined this way run every time the event occurs.

 rcEventRemove

 After the event occurs, it is removed from the list of defined events. Events defined this way run once.

String Argument Type: String
Optional
Specifies the string that defines string-oriented events. This argument is only relevant when the value you use for Event requires a string--that is, when Event is rcLoadSettingsFile, rcCommString, rcDisplayString, rcTimeOfDay, rcTime, rcSilence, or rcKbdEnabled.

Row Argument type: Integer or Enumeration
Optional
Specifies the row location for screen events. This value is relative to the current screen; the first row on screen is row 1. This argument is relevant when Event is rcEnterPos, rcExitPos, or rcDisplayString. When Event is rcDisplayString, you can use rcAnyRow to indicate that the event can occur at any row location.

 Note: You can also use this argument when Event is rcCommString. Specifying rcNoTranslation for the Row argument prevents the event from translating the characters using Reflection's translation tables.

Column Argument type: Integer or Enumeration
Optional
Specifies the column location for screen events. The left-most column is column 1. This argument is relevant when Event is rcEnterPos, rcExitPos, or rcDisplayString. When Event is rcDisplayString, you can use rcAnyCol to indicate that the event can occur at any column location.

Key Argument Type: Enumeration
Optional
Specifies a terminal key constant when EventType is rcTerminalKeystroke. For a complete list of terminal key constants, open the Reflection Type library in the Object Browser and look under TerminalKeys. Use rcAnyTerminalKey to specify any keystroke. Tip: To determine the appropriate constant for a particular keystroke, use the Reflection Keyboard Setup dialog box. When you click a key on the terminal keyboard, you'll see an identifier, such as VtF8 or HPF2, at the bottom of the dialog box. The terminal key constant is this identifier preceded by "rc" and followed by "Key," so the terminal key constant for VtF8 is rcVtF8Key.

CommandArguments Argument Type: String
Optional
This argument is valid when CommandType is rcVBMacro or rcRBScript. Use it to specify additional information to be passed to the macro or script.

 

 

image\jump.gif Example

image\jump.gif Keyword Index

image\popup.gif Related Topics

image\popup.gif Reflection products that use this command