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 Smart Desktop IF
⚖️ Flow

Conditional Branching by Desktop UI Elements (Smart Desktop IF) in RunMacro

Smart Desktop IF is a conditional branching command in RunMacro that evaluates whether desktop controls exist, match text, are enabled, or are checked.

Prerequisites#

  • Target desktop application is active on screen.
  • Workflow contains target Label anchors for branching.

Supported modes#

  • Desktop Mode — Probes UIA properties non-invasively without triggering mouse movement.

What it does#

The Smart Desktop IF command evaluates real-time UI element states via Microsoft UI Automation and branches macro execution accordingly. Supported conditions include: Element exists (element_exists), Element does not exist (element_not_exists), Text contains (text_contains), Text equals (text_equals), Is enabled (is_enabled), or Is checked (is_checked). When the condition evaluates to true, execution jumps to the designated Label or continues down the True block.

Screenshots & video#

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

When to use it#

  • Checking whether a confirmation popup or error dialog appeared so the macro can dismiss or confirm it.
  • Verifying whether a 'Submit' or 'Save' button is currently clickable (Enabled) or grayed out (Disabled) before issuing clicks.
  • Branching execution when an order status label reads 'Completed' versus 'Pending'.
  • Checking whether a 'Tax Invoiced' checkbox is checked to avoid duplicate invoice issuance.

When not to use it#

  • Evaluating web elements in browsers (use Smart HTML IF instead).
  • Pure variable comparisons unrelated to UI controls (use If Variable).

Configuration steps#

  1. In RunMacro, open the Flow › Smart Desktop IF command.
  2. Click 🎯 Pick Element and hover over the control to inspect.
  3. Choose the Condition: Element exists, Element not exists, Text contains, Text equals, Is enabled, or Is checked.
  4. If using a text condition, enter the target string in Condition Value (supports variables {var}).
  5. Select destination labels in If Label and optionally Else Label.
  6. Configure the Timeout (ms) probe duration (default 1500ms).
  7. Click Save to insert the condition into the workflow.

Every option explained#

🎯 Pick Element#

Target picker overlay to capture UIA identifiers for conditional probing.

Condition#

Evaluation mode: element_exists, element_not_exists, text_contains, text_equals, is_enabled, is_checked.

Condition Value#

Comparison string when testing text_contains or text_equals conditions.

If Label#

Target workflow Label jumped to immediately when the condition evaluates to True.

Else Label#

Target Label jumped to if condition evaluates to False (leave empty to proceed to next command).

Expected result#

Execution flows immediately to the appropriate label based on live control state.

Real example#

Example: Auto-dismiss popup notice if present#

  1. Add a Smart Desktop IF command.
  2. Pick the 'Dismiss' button or header of the announcement popup.
  3. Set condition to Element exists (element_exists) with 1000ms timeout.
  4. Set If Label to lbl_close_popup, and Else Label to lbl_continue.
  5. Under lbl_close_popup, place a Smart Click to dismiss the dialog.

Limitations and failure cases#

  • Apps elevated with Administrator rights require RunMacro to run elevated as well.

Tips & common mistakes#

For transient popup checks, set timeout between 1000–2000ms to allow sufficient time for window rendering.
Avoid excessively large timeouts (>10s) on elements that are rarely present to prevent pipeline delays.

Verification details#

  • commands/smart_desktop_if.py · verified 2026-09-30
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.