Infocenter

Adding a smart wait

A Smart Wait causes a macro to wait during playback until it recognizes a screen according to conditions that you set. If the macro recognizes the screen within the timeout period, it continues. If it does not, it stops.

To add a smart wait:

  1. Click Macro Manager on the toolbar.
  2. Click Record.
  3. When you get to the point at which you want to add a wait, click Smart Wait.
  4. Choose or type the conditions you want to use, and set the timeout interval.
  5. Click OK.

A macro can recognize a screen according to any or all of these conditions:

Field Count
The total number of host fields.

Input-Field Count
The total number of input fields (fields that you can type in).
The Macro Manager automatically records the number of fields for you.

Wait for OIA to Become Uninhibited
If checked, the OIA must become uninhibited (no data communication and you are able to enter keystrokes) before the macro continues.

Use Cursor Position
Identifies the screen by the cursor position.

Keyword
Any word that will appear on the screen and that you want the macro to recognize. You should try to choose a word that is unique to that screen.

Timeout
A value in milliseconds (for example, 10000 is 10 seconds). Until all the conditions that you define have been satisfied, the macro will wait for the time specified. If the timeout expires before all the conditions have been met, the macro will stop playing back and display a message telling you the line on which it failed.

A value less than or equal to zero adds an indefinite wait.

If the macro consistently times out too soon, edit the code to increase the value (WaitForScreen).

  • If the number of fields in your host application screen varies from time to time, you will sometimes not get a match for the Smart Wait. If this happens, re-record the macro without specifying either type of field count.
  • The Macro function performs automatic screen-recognition by watching the cursor position on each screen. Do not add a Smart Wait for every screen unless you are sure that the cursor is a sufficient way of recognizing a screen.