ui_select_items
Selects items by index in list or grid controls, supporting both replace and add selection modes. Handles virtualized lists and works with FlaUI and pywinauto backends.
Instructions
Select items by index in a list/grid control (DataGrid, ListView, ListBox).
With FlaUI backend: uses SelectionItemPattern (reliable for virtualized lists). With pywinauto backend: two strategies (tries both):
UIA SelectionItemPattern — works for non-virtualized lists
Coordinate click fallback — clicks items using cached rectangles (Ctrl+click for multi-select, plain click for first item)
For WPF virtualized lists (VirtualizingStackPanel), strategy 1 may fail because off-screen items don't have UI containers. Strategy 2 uses visible item coordinates from the cache. FlaUI backend handles this natively.
Args: automation_id: AutomationId of the list/grid control indices: List of 0-based item indices to select mode: "replace" (clear existing, select these) or "add" (add to existing selection)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| automation_id | Yes | ||
| indices | Yes | ||
| mode | No | replace |