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)" />

Related Topics    

Description

Causes task execution to pause at the current step until the terminal related condition to wait for ensues.

NOTE: If the condition to wait for does not occur, the task may wait indefinitely. In such cases, the Error Causes  properties of this step can be set to a timeout value and the On Error properties can be set to continue to the next step upon error.

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
  • TYPE="notext"
  • TYPE="cursorin"
  • TYPE="cursorout"
  • TYPE="blankscreen"
  • TYPE="noblankscreen"
  • TYPE="defaultprompt"
Specifies the condition to wait for. The available options are:
  • Text to appear - Wait for specific text to appear. Specify text in Text field.
  • Text to disappear -  Wait for specific text to disappear. Specify text in Text field.
  • Cursor moved to - Wait for cursor to move to specified coordinates. Specify position in Row and Column fields.
  • Cursor moved out of - Wait for cursor to move to out of specified coordinates. Specify position in Row and Column fields.
  • Screen to blank - Wait for screen to be blank.
  • Screen to contain text - Wait for screen to contain any text.
  • Default prompt - Wait for default prompt as specified in the Default prompt parameter of the Connect Terminal step.
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
  • MEASURE="milliseconds"
  • MEASURE="seconds"
  • MEASURE="minutes"
  • MEASURE="hours"
The time scale that corresponds to the value entered in the Timeout field. The available options are:
  • Milliseconds (default) - The timeout value will be measured in milliseconds.
  • Seconds - The timeout value will be measured in seconds.
  • Minutes - The timeout value will be measured in minutes.
  • Hours - The timeout value will be measured in hours.
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.

Description

Error Causes

On Error

Examples

NOTE:
  • 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.  

Copy
<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.

Copy
<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" />