Terminal - Wait

Declaration

<AMWAITFORTERMTEXT SESSION="TermSess1s" TIMEOUT="number" 
MEASURE="text (options)" USECASE="YES/NO" USERE="YES/NO" 
FOUNDTEXTVARIABLE="text" TYPE="TEXT">theText</AMWAITFORTERMTEXT>

Description: Causes task execution to pause at the current step until the 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.

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.

General Parameters

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 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</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:

  • milliseconds (default)

  • seconds

  • minutes

  • hours

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.  

Advanced Parameters

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

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 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>

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