Extract Desktop UI Element Text into Variables (Smart Get Text) in RunMacro
Desktop ModeRunMacro 3.5+
Smart Get Text extracts text directly from desktop UI controls (TextBoxes, Labels, Buttons) into variables via Windows UI Automation without clipboard copying.
Dialog & quick setup

- In RunMacro, select the Keyboard › Smart Get Text command.
- Click 🎯 Pick Element and hover over the target label, text box, or status control to capture.
- Specify the variable name in Result Variable (e.g.
order_id). - Optionally provide a regex in Regex Pattern to isolate numbers or codes (e.g.
\d+). - Ensure Trim whitespace is checked.
- Select Save to: variable or file.
- Click Save to insert the command into the workflow.
Options reference
Modes & when to use
Desktop Mode
Accesses text via UIA ValuePattern, TextPattern, or Name properties.
Best for
- Capturing newly generated invoice or contract numbers after completing transactions in enterprise apps.
- Reading account balances or payment totals to feed conditional logic (IF) branches.
- Extracting error messages or dialog warnings to record into logs or dispatch Telegram alerts.
- Grabbing customer tax IDs and names from desktop CRM screens into variables for cross-app automation.
Use an alternative when
- Web browser pages (use Smart HTML DOM text commands).
- Scanned raster text inside remote desktop sessions (use Scan OCR).
Before you run
- The target desktop application displaying the text or input field is open on screen.
- The target text element has been picked successfully.
Example workflow
Example: Capture invoice total amount and parse digits
- Add a Smart Get Text command.
- Pick the label showing 'Total: $1,500.00 USD'.
- Set Result Variable to
total_amount. - Enter Regex Pattern as
[0-9\.,]+to strip currency words. - Variable
{total_amount}now cleanly holds1,500.00.
Expected result: The control's text content is accurately assigned to the target variable or file.
Tips & limitations
Smart Get Text can even read masked input values if the underlying application exposes its value attribute via UIA.
For multi-row tables and DataGrids, use Smart Export Table rather than Smart Get Text to preserve column structures.
- Non-standard custom controls that omit Name and Value attributes may return empty strings.
- Controls completely excluded from the UIA tree require Scan OCR.
Applies to RunMacro 3.5+ · Desktop Mode · Windows 10/11
