Control Terminal

Declaration

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

See Also

Disconnect Terminal, Send Terminal Text, Get Terminal Text, Wait Terminal, Control Terminal

Description

Changes the properties of a currently established terminal session including window visibility or cursor position.

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 actions to prepare the terminal window to receive text, or to clear it after text has been retrieved.

The terminal actions are used in lieu of terminal emulation software. Using the terminal actions, legacy systems can be automated in the background without the use of 3rd party software.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Action

Text (options)

No

Show terminal window

ACTION="CLEARTERMINAL"

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

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

  • Hide terminal window: Hides the terminal window.

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

  • Set cursor position: Sets the position of the cursor in the terminal window. Specify position in Row and Column fields.

Cursor Row

Number

Yes if Action is Set cursor position

1

ROW="1"

Specifies the row number for the cursor position. This parameter is available only if the Action parameter is set to Set cursor position.

Cursor Column

Number

Yes if Action is Set cursor position

1

COLUMN="2"

Specifies the column number for the cursor position. This parameter is available only if the Action parameter is set to Set cursor position.

Session Name

Text

No

TermSess1

SESSION="TermSess2"

The session name that this action should correspond to. This session name must have been previously created with a prior Connect Terminal step. This allows several 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 Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or AutoMate extended functions, which can be entered by surrounding the expression in percentage signs (example: %FileDateTime(myVar)% or %myVar%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on function

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane 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 />