This project is read-only.

SSh.net and Reflection....

Mar 21, 2012 at 4:14 PM
Edited Mar 22, 2012 at 6:46 PM

For my everyday work  I use commercial product called Reflection created by Attachmate but I would like to change it to another - free of charge if possible

Reflection contains very useful and powerful Session object which allow to control and process your session using VBA macros. This Session object contains many methods like for example DefineEvent

I noticed from one of the latest discussion that there is similar method in SSH.net library: Expext.  But is there any way to create more than one Expect like  DefineEvent in Reflection? For example I want to wait 10 seconds (and in menawhile execute other piece of code) for incoming strings and then check if there was string1 or/and string2 or/and stirng3 etc received ?

The solution of that is probably regexp in expect but is there other method?

For all who are interested -below is the description from Reflection about DefineEvent method.

Syntax    object.DefineEvent Event, EventType, [String], [Row], [Column], [Key]

Description

Defines an event that can be waited or checked for later. Defining an event doesn't prevent processing of subsequent commands. You can check for the occurrence of defined events with CheckEvent or CheckEventNumber . You can pause to wait for defined events with WaitEvent or WaitEventNumber.
Once defined, an event remains defined as long as your Reflection session lasts, and may affect subsequent procedures that check for events. You can remove an individual event definition using RemoveEvent, and it is a good idea to use this method after you have checked for an event. You can use ClearEvents to remove all defined events.

Which arguments you need to use for this method depends on the event type you specify in the EventType argument.

Arguments

Event    Argument type: Integer or Enumeration
Required
Specifies a number identifying this event. Do not use the same number to define another event during the same Reflection session. Do not use 0 as the value for this argument without first removing this event.
    Use rcNextEvent to have Reflection automatically assign an event number. (The EventDefined property returns the number of the most recently defined event.)
EventType    Argument type: Enumeration
Required
The event being defined. The 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. For example, this statement defines an event of 3 seconds of silence:

.DefineEvent 1, rcSilence, "3"

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

Defines an event as a host connection being established. No additional arguments are needed for this event type. For example, the following event occurs when you make a connection:

.DefineEvent 1, rcEvConnected

rcEvDisconnected

Defines an event as a host connection becoming disconnected. No additional arguments are needed for this event type. For example, the following event occurs when you disconnect:

.DefineEvent 1, rcEvDisConnected

rcEnterPos

Defines an event as the positioning of the cursor at the specified screen coordinates, specified by the Row and Column arguments. 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. For example the following event occurs when the cursor enters the first column of any row:

.DefineEvent 1, rcEnterPos, ,1, rcAnyCol

rcExitPos

Defines an event as the positioning of the cursor at any location on the screen other than specified coordinates. (You can use Reflection's status bar to determine the row and column coordinates of your cursor as you work with a host application.) Use the Row and Column arguments to specify coordinates. For the event to occur, the cursor must have previously been at the 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. For example the following event occurs when the cursor leaves row 4, column 18:

.DefineEvent 1, rcExitPos, ,4, 18

rcCommString

Defines an event as the reception of the specified string from the host. Use the String argument to specify the string. For example, the following event occurs when the string "login" is received from the host.

.DefineEvent 1, rcCommString, "login"

rcDisplayString

Defines an event as the specified string appearing at the specified row and column 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. For example, the following event occurs when the string "Forms" appears in row 4, column 1:

.DefineEvent 1, rcDisplayString, "Forms", 4, 1

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). For example the following event occurs at 15:27 (3:27 PM).

.DefineEvent 1, rcTimeOfDay, "15:27:00"

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. For example, the following event occurs 5 seconds after this statement is executed:

.DefineEvent 1, rcTime, "5"

rcBlockModeEnter

The terminal has entered block mode. No additional arguments are needed for this event type. For example:

.DefineEvent 1, rcBlockModeEnter

rcBlockModeExit

The terminal has exited block mode. No additional arguments are needed for this event type. For example:

.DefineEvent 1, rcBlockModeExit

rcFileTransferDone

A file transfer has successfully completed. No additional arguments are needed for this event type. For example:

.DefineEvent 1, rcFileTransferDone

rcTerminalKeystroke

Defines an event as the transmission of the specified terminal key to the host. The Key argument defines the host function. The Key argument defines the host function. For example, the following event occurs when the F8 key is transmitted to an HP host:

.DefineEvent 1, rcTerminalKeystroke, , , , rcHpF8Key

String    Argument type: String
Optional
Specifies the string that defines string-oriented events. Use this argument when the value you use for EventType requires a string -- that is, when EventType is rcSilence, rcKbdEnabled, rcCommString, rcDisplayString, rcTimeOfDay, or rcTime.
Row    Argument type: Integer or Enumeration
Optional
Specifies the row location for screen events. Use a row number to specify a particular row, or use rcAnyRow to specify that the event can occur at any row location. Use this argument when EventType is rcEnterPos, rcExitPos, or rcDisplayString.

Column    Argument type: Integer or Enumeration
Optional
Specifies the column location for screen events. Use a column number to specify a particular column, or use rcAnyCol to specify that the event can occur at any column location. This argument is relevant when EventType is rcEnterPos, rcExitPos, or rcDisplayString.
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. To determine the appropriate constant for a particular keystroke, use the Reflection Keyboard Setup dialog box. When you click a key in 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.

Apr 27, 2012 at 5:00 PM

Am I reading this correctly if I say, in an extremely simplified way, that you want to 'script' SSHNet via this Reflection pluggable software from Attachmate?