Please enable JavaScript to view this site.

ESL Documentation

Prototype

subroutine EcsDoEmulateAndWatch(string:ScreenIDFile, string:ScreenName)

Description

Similar to EcsDoEmulate. A response is returned when the emulator displays a screen defined in a screen ID file or when you minimize the emulator window.  This allows the ESL application to response to other stimuli (for example, DDE), whilst the Emulator window is active.

Parameters

ScreenIDFile

Input

A string reference to a file containing a list of screens together with pattern matches for each screen. The format of the file is described below.

ScreenName

Output

The screen name as specified in the ScreenIDFile or blank, if the User minimizes the Emulator.

Screen ID File Format

The file is a standard text file that can be created with a standard editor such as Notepad. Each record is separated by a new-line character. There are 2 record types within the file:

The screen id record. This must be the first record within the file and must be followed by one or more match records. This record defines the name of each host screen, which you wish the ESL application to identify.

The match record(s) must follow a screen id record, therefore must be the last record in the file. The match record specifies the pattern of character that must be match the specified host screen. There is not a limit on the number of match records per screen id record, although to ensure the best performance the minimum number of records needed to identify the host screen is recommended.

The Screen Id Record Format

After any leading spaces, the 2 fields within this record are separated by a single space.

Record Type - The literal "screen". This field is not case sensitive.

Screen Name - A alphanumeric name for the screen that will be returned to the ESL application by this routine when the Host Screen was identified. The screen name field can be a maximum of 132 characters long. Any trailing spaces are ignored, but any other characters will invalidate the record.

The Match Record Format

After any leading spaces, the 3 fields within this record are separated by one or more spaces.

Row - The line on the host screen where the pattern matching starts. This numeric value must be a minimum of 1 and a maximum dependant on the number of lines on the terminal type being used.

Column - The character position with the specified row where the pattern matching starts. This numeric value must be a minimum of 1 and a maximum dependant on the number of characters within a line on the terminal type being used.

Pattern - A series of characters to be matched at the specified location on the host screen. This field must be enclosed in double quotes, which allows the pattern to include leading spaces. To enable the pattern to include a double quote, an escape sequence starting with a backslash is used. The maximum length of a pattern, excluding the enclosing double quotes, is 132 characters. The pattern may wrap across more than 1 line, however, it must not reach beyond the length of the emulator screen type, given the starting coordinating specified by the Row and Column fields. Any trailing spaces are ignored, but any other characters will invalidate the record.

Escape Sequences

Sequence

Meaning

\"

Double Quote

\\

Backslash

Example ScreenID File

screen MAIL

   1 78 "E01"

screen ESDL200

   1 2  "ESDL200"

screen ESDL190

   1 2  "ESDL190"

screen ESDL150

   1 2  "ESDL150"

screen ESDL210

   1 2  "ESDL210"

Return Value

ECS_E_NOTINIT

Not initialized - command was ignored

ECS_E_NOTCONN

Not connected to an active session

ECS_E_NOTAVAIL

Action is not available in this configuration

ECS_E_SCRIDFILE

Screen ID file not found

ECS_E_NOMEMORY

Not enough memory for screen IDs

ECS_E_BADSCRID

Screen ID file has illegal syntax

ECS_E_ERRORFREE

No errors were generated

Example

###********************************************

###  Action to wait for a specified host screen

###********************************************

action EmulateAndWatch is

    copy text of ScreenIDFileName_EF to ScreenIDFileName_SV

    call EcsDoEmulateAndWatch ( ScreenIDFileName_SV, ScreenName_SV )

    copy errorlevel to ErrorLevel_IV

    copy "EcsDoEmulateAndWatch" to Call_SV

if (ErrorLevel_IV != ECS_E_ERRORFREE) then

 action DisplayError

end if

 

response to stimulus EaselComServer ECS_EMULATEWATCHDONE

  copy "Screen " ScreenName_SV " was found" to Message_SV

  action DisplayMessage

  make Emulate_DB invisible

make Emulate_DB temporary

 

response to stimulus EaselComServer ECS_EMULATEWATCHERROR

copy eventparam to ErrorLevel_IV

action DisplayError

make Emulate_DB invisible

make Emulate_DB temporary