Information Center

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. Select View > Macro Manager to open the Macro Manager 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 screen on which it failed.

A value greater than zero must be specified. A value of less than or equal to zero will result in the global timeout value in the <HAScript> tag being used (unless the global timeout is disabled, in which case a value of less than or equal to zero adds an infinite wait).

If the macro consistently times out too soon, edit the code to increase the timeout (WaitForScreen) timeout value. You can edit either the "timeout" attribute in <HAScript> to affect the timeout value between screens for the entire macro, or the "timeout" attribute in <nextscreens> to change the timeout on a per screen basis. Note that the "timeout" attribute in <nextscreens> only overrides the "timeout" attribute in <HAScript> if (a) "timeout" in <HAScript> is -1 or (b) "timeout" in <nextscreens> is greater than zero.

  • 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.
  • Screen recognition is automatically based on OIA and field count. If these attributes are not sufficient for uniquely identifying each screen, add Smart Waits as needed to the macro.