REPEAT Statements (REPEAT/ENDREPEAT)

REPEAT Statements

Macro Recorder allows adding REPEAT X TIMES statements to a macro. A REPEAT X TIMES statement is a control flow statement which allows a portion of a macro to be executed iteratively. For example, if you have a batch of macro commands, which type "Hello" you can surround these commands with "Repeat 5 times" and "End Repeat" statements and "Hello" will be typed five times.

How REPEAT statements are processed

When Macro Player engine reaches the "REPEAT X TIMES" statement, it initializes an internal counter. When the "END REPEAT" statement is reached, the counter is increased by one and Macro Player goes up to the preceding REPEAT statement and runs through the commands again. When the counter reaches the value specified in the "REPEAT X TIMES" statement properties, looping ends.

There's also an "EXIT LOOP" statement that aborts the iteration and proceeds to the statement, next to the "END REPEAT".

Example

A REPEAT statement example of use (in human language):

  • [REPEAT 3 TIMES]
  • I will not chew gum in class
  • [ENDREPEAT]

    IMPORTANT: after inserting a REPEAT X TIMES statement remember to insert a corresponding ENDREPEAT.

    © JitBit Software Macro Recorder homepage