Terminal - Control

Declaration

<AMCONTROLTERM SESSION="text" ACTION="SETCURSORPOSITION" CURSORROW="number" CURSORCOL="number" />

Related Topics    

Description

Controls the terminal window of a currently established terminal session by performing a specific action, such as showing/hiding the terminal window, clearing the terminal window of all text or setting the cursor to a specific position.

NOTE: AutoMate's terminal activities can be used in lieu of terminal emulation software. Using the terminal activities, legacy systems can be automated in the background without the use of 3rd party applications.

Practical Usage

Generally used to make the terminal window visible or hidden, or to clear the window or set the cursor position. Commonly used with the Get terminal text or Send terminal text activities to prepare the terminal window to receive text, or to clear it after text has been retrieved.

Parameters

General

Property

Type

Required

Default

Markup

Description

Action

Text (options)

No

Show terminal

  1. ACTION="showterminal"

  2. ACTION="hideterminal"

  3. ACTION="clearterminal"

  4. ACTION="setcursorposition"

  5. ACTION="getcursorposition"

Specifies the action to perform on the terminal window. The available options are:

  • Show terminal (default) - Displays the terminal window.

  • Hide terminal - Hides the terminal window.

  • Clear terminal - Clears all text from the terminal window.

  • Set cursor - Sets the position of the cursor in the terminal window. Enter the desired position in the following Cursor Row and Cursor Column fields.

  • Get Cursor - Retrieves the position of the cursor in the terminal window and populates existing variables with the cursor row and cursor column.

Cursor row

Number

Yes, if Action selected is Set cursor

 

CURSORROW="2"

The row number in which to set the cursor.

Cursor column

Number

Yes, if Action selected is Get cursor

 

CURSORCOLUMN="10"

"The column number in which to set the cursor.

Session

Text

No

TermSess1

SESSION="TermSess2"

The name of a session previously created with a prior Connect Terminal step. This allows several terminal connections to be active simultaneously. If you are only using one connection at a time, you can leave this parameter set to the default value - TermSess1.

 

Description

Error Causes

On Error

Example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 1:

This step sets the cursor to position 2,3 in terminal "TermSess3".

<AMCONTROLTERM SESSION="TermSess3" ACTION="SETCURSORPOSITION" CURSORROW="2" CURSORCOL="3" />

Sample 2:

A sample task that uses all available terminal actions. Examining the step parameters and properties of this task may assist you in creating your own terminal emulation task.

<AMVARIABLE NAME="thePassword">password</AMVARIABLE>

<AMCONNECTTERM EMULATION="VT220" HOST="linux.networkautomation.com" SHOWTERMINALWINDOW="YES" />

<AMWAITFORTERMTEXT TYPE="TEXT">login:</AMWAITFORTERMTEXT>

<AMSENDTERMTEXT>%theUsername%{ENTER}</AMSENDTERMTEXT>

<AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG>

<AMWAITFORTERMTEXT TYPE="TEXT">Password:</AMWAITFORTERMTEXT>

<AMSENDTERMTEXT>%thePassword%{ENTER}</AMSENDTERMTEXT>

<AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG>

<AMDISCONNECTTERM />