Terminal - Control
Declaration
<AMTERMINAL ACTIVITY="control" SESSION="text" SESSION="text" ACTION="SETCURSORPOSITION" CURSORROW="number" CURSORCOL="number" />
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.
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 |
|
Specifies
the action to perform on the terminal window. The available options
are:
|
Cursor row | Number | Yes, if Action is set to Set cursor | (Empty) | CURSORROW="2" | The row number in which to set the cursor. |
Cursor column | Number | Yes, if Action is set to Get cursor | (Empty) | 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 Terminal - Connect 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. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Example 1
This step sets the cursor to position 2,3 in terminal "TermSess3."
<AMTERMINAL ACTIVITY="control" SESSION="TermSess3" ACTION="setcursorposition" CURSORROW="2" CURSORCOL="3" />
Example 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="theUsername" VALUE="Username" />
<AMVARIABLE NAME="thePassword" VALUE="password"></AMVARIABLE>
<AMTERMINAL HOST="linux.networkautomation.com" SESSION="TerminalSession1" SHOWTERMINALWINDOW="YES" EMULATION="vt220" ENCRYPTIONALGORITHMS="Any" AUTHENTICATIONMETHOD="Any" />
<AMTERMINAL ACTIVITY="waitfor" SESSION="TerminalSession1" TEXT="login" />
<AMTERMINAL ACTIVITY="sendtext" SESSION="TerminalSession1" TEXT="%theUsername% {ENTER}" />
<AMSHOWDIALOG MESSAGE="OK to proceed?"></AMSHOWDIALOG>
<AMTERMINAL ACTIVITY="waitfor" SESSION="TerminalSession1" TEXT="Password" />
<AMTERMINAL ACTIVITY="sendtext" SESSION="TerminalSession1" TEXT="%thePassword% {ENTER}" />
<AMSHOWDIALOG MESSAGE="OK to proceed?"></AMSHOWDIALOG>
<AMTERMINAL ACTIVITY="disconnect" SESSION="TerminalSession1" />