DocsFlowBreak Loop

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

RunMacro Break Loop command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Break Loop command in RunMacro.
  1. Identify the condition check point inside the active loop body.
  2. Place a conditional check (such as an IF or Find Image command).
  3. Inside the condition true branch, insert Control Flow › Break Loop.
  4. Save workflow. When the condition evaluates to true, Break jumps execution past the loop boundary.

Options reference

Innermost Loop Targeting

Automatically targets and exits the immediate enclosing loop level with zero manual parameter setup.

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

  1. For Each loop iterating over file rows.
  2. IF check: if {item} == "TARGET_ID".
  3. Inside IF: insert Break Loop command.
  4. 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

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.