Docs

RunMacro Documentation

Create your first robot, then go further as needed.

Clear step-by-step guides to create, run, and improve robots for repetitive computer work.

Docs Flow IF Condition
⚖️ Flow

Multi-condition IF block (AND/OR, Else If) in RunMacro

The IF command evaluates one or more logical expressions using AND/OR rules to branch workflow execution across dedicated code paths.

Prerequisites#

  • Required evaluation variables are declared or extracted prior to the check.
  • Logical branching rules (AND or OR mode) are clearly defined.

Supported modes#

  • Desktop Mode
  • Browser Mode
  • RunMacro Runner

What it does#

The IF command opens a multi-clause logical condition block. Users can chain multiple evaluation rules using AND (All conditions met) or OR (Any condition met), comparing variable values against strings, numbers, or emptiness checks. An IF block can be further expanded with Else If branches, a fallback Else block, and is cleanly closed with End If.

Screenshots & video#

RunMacro IF Condition command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the IF Condition command in RunMacro.

When to use it#

  • Evaluating multiple criteria simultaneously before acting (e.g. balance > 0 AND status = "Ready").
  • Handling cascading multi-path decisions using structured IF -> Else If -> Else blocks.
  • Validating input parameters or extracted data rows before proceeding with dangerous tasks.

When not to use it#

  • Repeating actions a fixed number of times (use Loop or For Each instead).
  • Checking pure DOM element states in browsers (prefer Smart HTML IF).

Configuration steps#

  1. Add a Control Flow › IF command to the workflow.
  2. Select the evaluation mode: Match ALL (AND) or Match ANY (OR).
  3. Add condition rows: pick target variable, comparison operator (=, !=, >, <, contains...), and reference value.
  4. (Optional) append Else If branches for alternative checks or Else for fallbacks.
  5. Place target commands inside each corresponding block branch. Close with End If. Save.

Every option explained#

Logical Match Mode (AND / OR)#

AND requires every sub-condition to pass; OR requires at least one sub-condition to evaluate to true.

Comparison Operator#

Supports equal (=), not equal (!=), greater (>), less (<), greater-or-equal (>=), less-or-equal (<=), contains, not contains, is empty, is not empty.

Variable & Comparison Value#

The source variable being evaluated and the target value (supports literals, numbers, or {var} placeholders).

Else If Branch#

Creates an additional conditional branch evaluated only when the preceding IF branch evaluates to false.

Else & End If#

Else executes when all prior conditions fail; End If marks the structural termination of the condition block.

Expected result#

The runner executes commands within the first matching condition branch and jumps past End If when finished.

Real example#

Example: Verify account balance and active status#

  1. Insert IF with match mode AND.
  2. Row 1: variable {balance} > 100.
  3. Row 2: variable {status} = "Active".
  4. Inside true branch: proceed with transaction.
  5. Close with End If.

Limitations and failure cases#

  • Numeric comparisons attempt auto-casting; non-numeric values fall back to lexicographical string ordering.
  • Omitting the terminating End If causes workflow indentation hierarchies to become corrupted.

Tips & common mistakes#

Use the is_not_empty operator to verify that a variable has been populated before performing calculations.
IF blocks can be nested indefinitely; RunMacro automatically renders tree indentation in the workflow editor.

Verification details#

  • commands/control_flow.py
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.