DocsFlowWhile Loop

Conditional While Loop block in RunMacro

Desktop ModeBrowser ModeRunMacro RunnerRunMacro 3.5+

While Loop repeatedly executes child commands as long as a variable condition remains met, protected by a safety iteration cap.

Dialog & quick setup

RunMacro While Loop command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the While Loop command in RunMacro.
  1. Add a Control Flow › While Loop command to your workflow.
  2. Select the target variable to monitor (e.g. {status}).
  3. Select comparison operator (!=, ==, <, contains...) and enter the target value.
  4. Set the Safety Cap (Max Iterations) threshold (e.g. 100) to protect against infinite loops.
  5. Place target commands inside the block. Terminate with End Loop. Save.

Options reference

Monitored Variable

The source variable re-evaluated before every iteration cycle.

Operator

Comparison operator: =, !=, <, <=, >, >=, contains, not_contains, is_empty, is_not_empty.

Target Value

The target value to evaluate against, supporting literal text, numbers, or variable tokens.

Max Iterations (Safety Cap)

Maximum permitted execution cycles; exceeding this cap halts iteration to prevent frozen macros.

Terminating End Loop

Marks the end boundary of the loop; execution loops back to the While header from here.

Modes & when to use

Desktop Mode
Browser Mode
RunMacro Runner

Best for

  • Polling an asynchronous operation whose completion duration is variable (e.g. while {status} != "Done").
  • Processing sequential queue items until a pointer or balance threshold is reached.
  • Retrying an operation sequence while checking success conditions after each cycle.

Use an alternative when

  • Iterating through collections of files or list items (For Each is much better).
  • Repeating an action a predetermined fixed number of times (use Loop instead).
Before you run
  • The monitored variable is initialized prior to entering the loop.
  • A defined termination condition exists so the loop does not exhaust its safety cap unintentionally.

Example workflow

Example: Poll until processing status changes to "Ready"

  1. Initialize variable {status} = "Processing".
  2. Insert While: {status} != "Ready", Max Iterations = 50.
  3. Inside: Re-read status from UI, Delay 1000ms.
  4. Close with End Loop. When {status} equals "Ready", the loop exits immediately.
Expected result: Enclosed commands repeat on each cycle until the condition evaluates to false, then flow advances past End Loop.

Tips & limitations

Ensure at least one command inside the While block updates the monitored variable (or introduces an appropriate Delay).
Avoid disabling or setting excessive Max Iterations thresholds on unattended server automations.
  • If the variable is never updated inside the block, the loop will consume all iterations up to the safety cap.
  • Cycle interval timing depends entirely on the execution speed and delays of child commands inside the block.

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.