Break out of an active loop immediately in RunMacro
Desktop ModeBrowser ModeRunMacro RunnerRunMacro 3.5+
The Break command instantly exits the active enclosing loop (While, For Each, Loop) and advances execution past End Loop.
Dialog & quick setup

- Identify the condition check point inside the active loop body.
- Place a conditional check (such as an IF or Find Image command).
- Inside the condition true branch, insert Control Flow › Break Loop.
- Save workflow. When the condition evaluates to true, Break jumps execution past the loop boundary.
Options reference
Modes & when to use
Desktop Mode
Browser Mode
RunMacro Runner
Best for
- Searching collections: exiting immediately once a target item, image, or value is located.
- Encountering critical errors during an iteration where halting the whole batch is required for safety.
- Satisfying an early completion condition inside complex While or For Each loops.
Use an alternative when
- Skipping only the current cycle to start the next iteration (use Continue instead).
- Returning from a sub-macro back to the parent macro (use Goto Parent File).
Before you run
- Break must be positioned inside a valid loop block (Loop, While, or For Each).
- Typically enclosed in an IF condition to determine the appropriate exit timing.
Example workflow
Example: Search list items and break on match
- For Each loop iterating over file rows.
- IF check: if {item} == "TARGET_ID".
- Inside IF: insert Break Loop command.
- After End Loop: display success notification that target was found.
Expected result: The loop halts immediately at the Break call and execution continues with the command following the loop block.
Tips & limitations
In nested loops, Break only exits the innermost enclosing loop; outer parent loops remain unaffected.
Only place Break commands inside an active loop block; using Break outside loops is flagged as an invalid structure error.
- Break only affects the local synchronous execution thread; background threads cannot be halted via Break.
- Corrupted loop hierarchies missing an End Loop boundary will prevent the runner from locating the exit target safely.
Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode & RunMacro Runner · Windows 10/11
