DocsKeyboardSmart Get Text

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

RunMacro Smart Get Text command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Smart Get Text command in RunMacro.
  1. In RunMacro, select the Keyboard › Smart Get Text command.
  2. Click 🎯 Pick Element and hover over the target label, text box, or status control to capture.
  3. Specify the variable name in Result Variable (e.g. order_id).
  4. Optionally provide a regex in Regex Pattern to isolate numbers or codes (e.g. \d+).
  5. Ensure Trim whitespace is checked.
  6. Select Save to: variable or file.
  7. Click Save to insert the command into the workflow.

Options reference

🎯 Pick Element

Interactive target picker to capture target element UIA identification properties.

Result Variable

Identifier of the variable where the extracted string is stored (referenced downstream as {var_name}).

Regex Pattern

Regular expression pattern to filter or isolate substrings (e.g. INV-\d+). Leave empty to retain full text.

Trim whitespace

Automatically strips leading and trailing spaces and line breaks from the captured text.

Timeout (ms)

Maximum time to wait for the element to materialize and expose text data (default 3000ms).

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

  1. Add a Smart Get Text command.
  2. Pick the label showing 'Total: $1,500.00 USD'.
  3. Set Result Variable to total_amount.
  4. Enter Regex Pattern as [0-9\.,]+ to strip currency words.
  5. Variable {total_amount} now cleanly holds 1,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

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.