Win Set Value
Win Set Value
Section titled “Win Set Value”Type: win-set-value · Package: Desktop Activities v1.0.8
Sets the value of an input field using the UIA Value pattern. It is similar to Win Type with method = value, but more direct: it just sets the value, with no keyboard simulation options. Fast and reliable for standard text fields.
How it works
Section titled “How it works”It locates the field by its selector, brings its window to the front and sets value, converted to text, replacing the current content. The log records which field was written, never the value.
Three kinds of control don’t accept a value through UIA, and the activity fills them the way a person would, checking afterwards that the value stuck:
- Windows date picker (the DateTimePicker of WinForms, MFC, VB6, Delphi… applications): it types day, month and year in the order of the machine’s date format.
valuecan be a date, ayyyy-MM-ddtext or a date in the machine’s format. - WinForms DataGridView grid cell: it selects the cell, types the value and confirms with Tab, so the application recalculates.
- Fields in Java applications: it clicks the field, clears its content (Ctrl+A, Delete) and types the value with the keyboard.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selector | selector | — | The field to set. |
value | string | — | The value to set. Numbers and dates are converted to text; a date picker also accepts a date. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanDesktopSession | — | Win Attach session. Inside a body it is taken automatically; without a session, the selector must include the window. |
timeout | number | 30000 | Maximum ms to wait for the element. Empty = the project’s UI timeout or, if not set, 30000. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
The element does not support the Value pattern. | The control is not an editable field for UI Automation. Use Win Type with method = simulate. |
The element is read-only. | The field is locked (for example, until another option is checked). Enable it first or check it’s the right field. |
The value is not a valid date. Use yyyy-MM-dd or the machine format (…). | In a date picker, value could not be read as a date. Pass it as yyyy-MM-dd or as a date. |
The date picker did not keep the date after typing it field by field. | The application rejected or changed the date (out of range, invalid day). Check the value. |
An empty value cannot be typed into a grid cell; … | Grid cells aren’t emptied by typing. Use the application’s own way (for example, the Delete key with Win Key Press). |
Could not select the grid cell, so no keys were sent. / The target window is not in the foreground, so no keys were sent. | The cell or the window didn’t get the focus. Close any dialog covering it and retry. |
The grid cell did not keep the typed value (the application rejected or changed it). | The application’s validation rejected the value. Check the expected format. |
The element is outside the visible area and could not be scrolled into view, … | The field is hidden by its container’s scrolling. Add a Win Scroll before it. |
Element not found with selector {…}. | See common errors. |
Example
Section titled “Example”Win Set Value selector = (field "Quantity") value = toString(quantity)Win Set Value selector = (date "Due date") value = "2026-12-31"Related activities
Section titled “Related activities”- Win Type — type with the option to simulate the keyboard.
- Win Get Text — read the current value.