ScreenTO

TerminalEmulators. ScreenTO

ScreenTO

Constructor

new ScreenTO()

A terminal emulator screen that fully supports HLLAPI.

Methods

cursorPosition() → {Promise.<Object>}

The terminal emulator screen's current row and current column.
Returns:
a promise that is fulfilled with the object's cursorPosition.
Type
Promise.<Object>

getText(area[opt]) → {Promise.<string>}

Returns the text from the specified screen rectangle.
Parameters:
NameTypeAttributesDescription
areaObject <optional>
If an Area object is passed, it will return the string from that location.
Properties
NameTypeAttributesDescription
topnumber <optional>
Top position of the rectangle.
leftnumber <optional>
Left position of the rectangle.
bottomnumber <optional>
Bottom position of the rectangle.
rightnumber <optional>
Right position of the rectangle.
Returns:
a promise that is fulfilled with the contents of the specified text.
Type
Promise.<string>

id() → {Promise.<number>}

The terminal emulator screen ID.
Returns:
a promise that is fulfilled with the object's terminal emulator screen ID.
Type
Promise.<number>

inputFieldCount() → {Promise.<number>}

The terminal emulator screen input field count.
Returns:
a promise that is fulfilled with the object's terminal emulator screen inputFieldCount.
Type
Promise.<number>

label() → {Promise.<string>}

The label of the terminal emulator screen.
Returns:
a promise this is fulfilled with the label of the terminal emulator screen.
Type
Promise.<string>

protectedFieldCount() → {Promise.<number>}

The protected field count of the terminal emulator screen.
Returns:
a promise that is fulfilled with the object's Terminal Emulator screen protectedFieldCount.
Type
Promise.<number>

sendTEKeys(keys) → {Promise.<void>}

Sends a keystroke or string of keystrokes to the current cursor position on the emulator screen.
Parameters:
NameTypeDescription
keysstring | KeysThe string or terminal emulator keys to type in the object.
Returns:
a promise that is fulfilled when the sendTEKeys operation ends.
Type
Promise.<void>

setCursorPosition(positionOrRow, column[opt]) → {Promise.<void>}

Changes the position of the cursor within the emulator screen.
Parameters:
NameTypeAttributesDescription
positionOrRowObject | numberIf an object is passed, it will change the position of the cursor within the emulator screen.
If a number is passed, it will be interpreted as a row.
Properties
NameTypeAttributesDescription
rownumber <optional>
The row position of the cursor in the emulator screen.
columnnumber <optional>
The column position of the cursor in the emulator screen.
columnnumber <optional>
If a number is passed, it changes the position of the cursor within the emulator screen.
Returns:
a promise that is fulfilled when the setCursorPosition operation ends.
Type
Promise.<void>

setText(Text, positionOrRow[opt], column[opt]) → {Promise.<void>}

Copies a string to a specific location in the emulator screen.
Parameters:
NameTypeAttributesDescription
Textstringthat will be written in the specified position within the emulator screen.
positionOrRowObject | number <optional>
If an object is passed, it will copy the string to that location.
If a number is passed, it will be interpreted as a row.
Properties
NameTypeAttributesDescription
rownumber <optional>
The row position of the cursor in the emulator screen.
columnnumber <optional>
The column position of the cursor in the emulator screen.
columnnumber <optional>
If a number is passed, it will copy the string to this location.
Returns:
a promise that is fulfilled when the setText operation ends.
Type
Promise.<void>

size() → {Promise.<Object>}

The terminal emulator screen column count and row count.
Returns:
a promise that is fulfilled with the object's size.
Type
Promise.<Object>

sync(milliseconds[opt]) → {Promise.<void>}

Waits until a response is received from the host and the emulator status is set to Ready, or until the timeout is reached, before continuing with the run session.
Parameters:
NameTypeAttributesDescription
millisecondsnumber <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled when the sync operation ends.
Type
Promise.<void>

waitForText(text, milliseconds[opt]) → {Promise.<boolean>}

Waits for specific text to appear on the emulator screen before continuing the run session.

Example 1:
Use the waitForText method to wait 10 seconds for the string "CH70001 LAST ACCESS AT 14:27:07 ON THURSDAY", where this string is defined as a regular expression:
waitForText(new RegExp(".*LAST ACCESS AT \d\d:\d\d:\d\d ON .*DAY.*"), 10000)

Example 2:
Use the waitForText method to wait 5 seconds for the string "User":
waitForText("User", 5000)
Parameters:
NameTypeAttributesDescription
textstring | RegExpThe specified string or regular expression for which the emulator screen is waiting.
millisecondsnumber <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled with the state of the specified inputs.
Type
Promise.<boolean>

waitForTextInArea(text, area, milliseconds[opt]) → {Promise.<boolean>}

Waits for specific text to appear on the emulator screen before continuing the run session.

Example 1:
Use the waitForText method to wait 10 seconds for the string, "CH70001 LAST ACCESS AT 14:27:07 ON THURSDAY", where this string is defined as a regular expression:
waitForText(new RegExp(".*LAST ACCESS AT \d\d:\d\d:\d\d ON .*DAY.*"), {top: 6, left: 53, bottom: 6, right: 60}, 10000)

Example 2:
Use the waitForText method to wait 5 seconds for the string User":
waitForText("User", {top: 6, left: 53, bottom: 6, right: 60}, 5000)
Parameters:
NameTypeAttributesDescription
textstring | RegExpThe specified string or regular expression for which the emulator screen is waiting.
areaObjectIf an Area object is passed, it will wait for text from that location.
If a number is passed, it will wait this number of milliseconds for a response..
Properties
NameTypeDescription
topnumberTop position of the rectangle.
leftnumberLeft position of the rectangle.
bottomnumberBottom position of the rectangle.
rightnumberRight position of the rectangle.
millisecondsnumber <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled with the state of the specified inputs.
Type
Promise.<boolean>