Causes task execution to pause at the current line until the specified condition exists at the terminal. Commonly used to wait for a condition that indicates the terminal is ready for the next step of the task. Waits for text, a blank screen, a default prompt, or a cursor position to exist in a terminal session. If the condition is met, the task continues. Otherwise it fails. The terminal actions are used in lieu of terminal emulation software. Using these actions, legacy systems can be automated in the background without the use of third-party software.
Declaration
<AMWAITFORTERMTEXT SESSION="TermSess1s" TIMEOUT="number" MEASURE="text (options)" USECASE="YES/NO" USERE="YES/NO" FOUNDTEXTVARIABLE="text" TYPE="TEXT">theText</AMWAITFORTERMTEXT>
Example 1 - This sample step waits for the text "Wait for this text to appear" to appear in terminal session "TermSess1s." Use case sensitivity. Wait times out after 10 seconds.
<AMWAITFORTERMTEXT SESSION="TermSess1s" TIMEOUT="10" MEASURE="seconds" USECASE="YES" USERE="YES" FOUNDTEXTVARIABLE="theVar" TYPE="TEXT">Wait for this text to appear.</AMWAITFORTERMTEXT>
Example 2 - A example 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 />
See Also: Connect Terminal, Disconnect Terminal, Send Terminal Text, Wait Terminal, Control Terminal
Property |
Type |
Required |
Default |
Markup |
Description |
Wait for |
Text (options) |
No |
Text to appear |
TYPE="BLANKSCREEN" |
Specifies the condition to wait for. The available options are:
|
Text |
Text |
Yes |
(Empty) |
>text</AMWAITFORTERMTEXT> |
The text that is to appear or disappear. Only valid if Text to appear or Text to disappear is the selected Wait for option. |
Regular Expression |
Yes/No |
No |
No |
USERE="YES" |
If set to YES, specifies that the value entered in the Text parameter is a regular expression. If set NO, specifies that the Text parameter contains literal text. This parameter is set to NO by default. |
Case Sensitive |
Yes/No |
No |
No |
USECASE="YES" |
If set to YES, specifies that the value entered in the Text parameter is case sensitive. If set NO, the Text parameter is case insensitive. This parameter is set to NO by default. |
Cursor Row |
Number |
No |
(Empty) |
ROW="1" |
Indicates the row number for the cursor position to wait for. This parameter is available only if the Wait for parameter is set to Cursor moved to or Cursor moved out of. |
Cursor column |
Number |
No |
(Empty) |
COLUMN="2" |
Indicates the column number for the cursor position to wait for. This parameter is available only if the Wait for parameter is set to Cursor moved to or Cursor moved out of. |
Timeout |
Number |
No |
5000 |
TIMEOUT="50" |
The number of milliseconds, seconds, minutes, or hours that this step should wait before timing out. The value entered corresponds to the time scale selected in the Measure parameter below. |
Measure |
Text (options) |
No |
Milliseconds |
MEASURE="seconds" |
The time scale that corresponds to the value entered in the Timeout field. The available options are:
|
Session name |
Text |
No |
TermSess1 |
SESSION="TermSess1s" |
The session name to associate with this action. This session name must have been previously created with a prior Connect Terminal step. This allows several connections to be active simultaneously. The default value is TermSess1. |
Property |
Type |
Required |
Default |
Markup |
Description |
Populate variable with found text |
Text |
No |
(Empty) |
FOUNDTEXTVARIABLE="VariableName" |
Indicates the name of an existing variable in which to populate with the found text. This parameter is available only if the Wait for parameter is set to Text to appear or Screen to contain text. |