Conditional Branching by Desktop UI Elements (Smart Desktop IF) in RunMacro
Desktop ModeRunMacro 3.5+
Smart Desktop IF is a conditional branching command in RunMacro that evaluates whether desktop controls exist, match text, are enabled, or are checked.
Dialog & quick setup

- In RunMacro, open the Flow › Smart Desktop IF command.
- Click 🎯 Pick Element and hover over the control to inspect.
- Choose the Condition: Element exists, Element not exists, Text contains, Text equals, Is enabled, or Is checked.
- If using a text condition, enter the target string in Condition Value (supports variables
{var}). - Select destination labels in If Label and optionally Else Label.
- Configure the Timeout (ms) probe duration (default 1500ms).
- Click Save to insert the condition into the workflow.
Options reference
Modes & when to use
Desktop Mode
Probes UIA properties non-invasively without triggering mouse movement.
Best for
- 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.
Use an alternative when
- Evaluating web elements in browsers (use Smart HTML IF instead).
- Pure variable comparisons unrelated to UI controls (use If Variable).
Before you run
- Target desktop application is active on screen.
- Workflow contains target Label anchors for branching.
Example workflow
Example: Auto-dismiss popup notice if present
- Add a Smart Desktop IF command.
- Pick the 'Dismiss' button or header of the announcement popup.
- Set condition to Element exists (element_exists) with 1000ms timeout.
- Set If Label to
lbl_close_popup, and Else Label tolbl_continue. - Under
lbl_close_popup, place a Smart Click to dismiss the dialog.
Expected result: Execution flows immediately to the appropriate label based on live control state.
Tips & limitations
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.
- Apps elevated with Administrator rights require RunMacro to run elevated as well.
Applies to RunMacro 3.5+ · Desktop Mode · Windows 10/11
