Wait Terminal

Declaration

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

See Also

Connect Terminal | Control Terminal | Disconnect Terminal | Get Terminal Text | Send Terminal Text

Description

Causes task execution to pause at the current line until the specified condition exists at the terminal.

Practical Usage

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 3rd party software.

Parameters

General Properties

Property

Type

Req'd

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 Properties

Property

Type

Req'd

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 Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane 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 />

 

↑ Top of Page