Terminal - Wait for
Declaration
<AMTERMINAL ACTIVITY="waitfor" SESSION="text" TYPE="text (options)" TEXT="text" USERE="YES/NO" USECASE="YES/NO" TIMEOUT="number" MEASURE="text (options)" ROW="number" COLUMN="number" FOUNDTEXTVARIABLE="text" SCOPE="text (options)" />
Description
Causes task execution to pause at the current step until the terminal related condition to wait for ensues.
Practical usage
A delay mechanism commonly used to suspend execution until a condition takes effect indicating the terminal is ready for the next step. Use this activity if the terminal requires you to wait until it completes a process or operation.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Wait for | Text (options) | No | Text to appear |
|
Specifies
the condition to wait for. The available options are:
|
Text | Text | Yes | (Empty) | TEXT="Smith" | 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 selected, 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 disabled by default. |
Case sensitive | Yes/No | No | No | USECASE="YES" | If selected, specifies that the value entered in the Text parameter is case sensitive. If set NO, the Text parameter is case insensitive. This parameter is disabled by default. |
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 |
|
The time scale
that corresponds to the value entered in the Timeout
field. The available options are:
|
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. |
Session | Text | No | TerminalSession1 | SESSION="TermSess1s" | The session name to associate with this action. This session name must have been previously created with a prior Terminal - Connect step. This allows several connections to be active simultaneously. The default value is TerminalSession1. |
Advanced
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. |
Examples
- 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 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.
<AMTERMINAL ACTIVITY="waitfor" SESSION="TermSess1s" TEXT="Wait for this text to appear" USERE="YES" USECASE="YES" TIMEOUT="10" MEASURE="seconds" FOUNDTEXTVARIABLE="theVar" />
Example 2
This sample task uses an assortment of terminal activities to automate a terminal logon process. 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" />