Repeat Exit

 

The Repeat Exit command is used to exit out of a repeat loop before the entire cycle is completed. This command would typically be used in conjunction with a conditional If statement. If the condition is met, the macro exits the repeat loop before the entire cycle is complete. The macro then continues with the command that follows the Repeat Exit.

 

The Break command may also be used to exit from a repeat loop. Use the Continue command if needing to skip to the end of the Repeat loop and start with a new repeat cycle.

 

This command does not open an editable Macro Express window. Expand the Repeat category and double click on the Repeat Exit command to insert it directly into the script.

 

 

Sample Macro

Below is a modified Copy and Paste Routine macro demonstrated in the Tutorial. If specific text is found during the clipboard copy, the macro exits the repeat loop. Otherwise it continues cycling through the loop.

 

Repeat Start (Repeat 100 times)

  Window Activate: notepad

  Wait for Window Title: notepad

  Text Type (Simulate Keystrokes): <SHIFT><END>

  Clipboard Copy

  If Clipboard Contains "phrase I'm looking for"

    Repeat Exit

  End If

  Text Type (Simulate Keystrokes): <HOME><ARROW DOWN>

  Window Activate: wordad

  Wait for Window Title: wordpad

  Clipboard Paste

  Text Type (Simulate Keystrokes): <ENTER>

End Repeat