Skip to content

Desktop Activities

Version: 1.0.0  ·  ID: zoan-packages-desktop  ·  Author: Zoan Software

The Desktop package automates Windows desktop applications: installed programs such as an ERP, an accounting system, a desktop banking application or any Windows app. The bot interacts with its windows and controls—buttons, fields, lists, tables—just like a person with a keyboard and mouse.

Underneath it uses UI Automation (UIA3), Windows’ accessibility technology, which allows you to reliably “see” an app’s controls (not by screen coordinates, but by the actual element). It also supports Java desktop applications.

To automate an app you must first connect to its window. You have two pieces:

  • Open App: launches the application (if it is not open) and returns its process identifier (PID).
  • Win Attach: attaches to a window and returns a session (ZoanDesktopSession).

As in Browser, there are two ways to work with the session:

Activities within body inherit the session automatically; you don’t set session to any.

Win Attach selector = (ventana "Calculadora")
└─ body:
Win Click selector = (botón "5")
Win Click selector = (botón "+")
Win Get Text selector = (display) → output: resultado

Win Attach saves the session to a variable; each activity receives it in session, and at the end you close with Win Close.

Win Attach selector = (ventana "ERP") → output: app
Win Type session = = app selector = (campo "Usuario") text = "admin"
Win Close session = = app

As in the browser, a selector identifies the control to act with (this button, that field). You capture it with UI Discover, pointing at the element with the mouse; Zoan Automation saves a robust reference based on the UIA properties of the control (its controlType, name, automationId…), which survives changes in position or window size.

Concept 3: interaction methods (UIA vs physical)

Section titled “Concept 3: interaction methods (UIA vs physical)”

Several activities offer two ways to act on a control, and it is important to understand the difference:

Action”UIA” method (default)“Physical” method
Win Clickinvoke — activates control by its UIA pattern. Reliable, does not need the window to be visible.mouse — moves the mouse and clicks real.
Win Typevalue — maps the text by the UIA Value pattern. Fast and safe.simulate — simula pulsaciones de teclado.

Start with the default method (invoke/value): it is more reliable. Switch to physical (mouse/simulate) only if a “rogue” control does not respond to the UIA (some custom or key-validating controls).

ActivityTypeOutputWhat it does
Open Appopen-appnumberLaunch an application and return its PID
Win Attachwin-attachZoanDesktopSessionConnects to a window
Win Focuswin-focusBring a window to the front
Win Closewin-closeClose the window and release the session
ActivityTypeOutputWhat it does
Win Clickwin-clickClicks on an item
Win Typewin-typeWrite text in a field
Win Set Valuewin-set-valueAssigns the value of a field (Value pattern)
Win Checkwin-checkCheck/uncheck a checkbox or radio
Win Selectwin-selectSelect an item from a combo/list
Win Key Presswin-key-pressSend a key or combination
Win Scrollwin-scrollMove an element with scroll
ActivityTypeOutputWhat it does
Win Get Textwin-get-textstringText or value of an element
Win Get Attributewin-get-attributeobjectA property of the element (enabled, value…)
Win List Itemswin-list-itemsstring[]Items available from a combo/list
Win Element Existswin-element-existsbooleanDoes the element exist and is visible?
Win Extract Tablewin-extract-tableDataTableExtract a table/grid to a DataTable
ActivityTypeOutputWhat it does
Win Wait Forwin-wait-forbooleanWait for an element to appear or disappear
Win Screenshotwin-screenshotCapture the window or an element to a file

Open a system, log in and read data:

Open App path = "C:/ERP/erp.exe" → output: pid
Win Attach selector = (ventana "ERP — Login")
└─ body:
Win Type selector = (campo "Usuario") text = = credential("erp")["user"]
Win Type selector = (campo "Clave") text = = credential("erp")["password"]
Win Click selector = (botón "Ingresar")
Win Wait For selector = (ventana "ERP — Inicio") state = visible
Win Get Text selector = (etiqueta "Saldo") → output: saldo