Terminal - Get Text
Description: Retrieves text from the terminal during an established terminal session and populates a variable with the results. This action can be set to retrieve text from the entire screen, the current line, a specified line, or a specified range.
Practical Usage
Generally used to get text from an existing terminal session that was previously created by a Connect Terminal step. The terminal actions are used in lieu of terminal emulation software. With the use of the terminal actions, legacy systems can be automated in the background without the use of third-party software.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Text to Get |
Text (options) |
No |
Entire screen |
ACTION="CURRENTLINE" |
The location from which to retrieve the text. The available options are:
|
Line |
Number |
Yes if Text to Get parameter is set to Specific line |
(Empty) |
LINE="4" |
The line number to retrieve text from. This parameter is available only if the Text to Get parameter is set to Specific line. |
Beginning Row |
Number |
Yes if Text to Get is Range |
(Empty) |
BEGINROW="11" |
The beginning row of the range of text to get. This parameter is available only if the Text to Get parameter is set to Range. |
Beginning Column |
Number |
Yes if Text to Get is Range |
(Empty) |
BEGINCOL="3" |
The beginning (left) column of the range of text to get. This parameter is available only if the Text to Get parameter is set to Range. |
Ending Row |
Number |
Yes if Text to Get is Range |
(Empty) |
ENDROW="24" |
The ending row of the range. This parameter is available only if the Text to Get parameter is set to Range. |
Ending Column |
Number |
Yes if Text to Get is Range |
(Empty) |
ENDCOL="20" |
The ending (right) column of the range. This parameter is available only if the Text to Get parameter is set to Range. |
Place Buffer into Variable |
Text |
Yes |
(Empty) |
RESULTVARIABLE="Var1" |
The name of the variable in which to place the retrieved text. |
Session Name |
Text |
No |
TermSess1 |
SESSION="TermSess2" |
The session name from which to get the text. This session name must have been previously created with a Connect Terminal step. This allows several connections to be active simultaneously. If you are only using one connection at a time, do not specify a value other than the default. |
Sample 1: Get the contents of line 3 on terminal "mySession" and place into the variable "var1".
<AMGETTERMTEXT SESSION="mySession" RESULTVARIABLE="var1" ACTION="LINE" LINE="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 />