app_invoke_element
Press buttons, set text, or expand nodes in WPF dialogs using native UI Automation patterns, avoiding simulated clicks and focus stealing.
Instructions
Press, set or expand an element through UI Automation patterns.
PATTERNS ARE NOT A SIMULATED CLICK. MSAA offers little beyond a default action, which is why the rest of this layer falls back to moving a real mouse. UIA exposes what a control actually implements: Invoke to press, Value to set text, ExpandCollapse to open a node. Those are supported operations, so they move no pointer, take no focus, and cannot land on whatever happens to be under the cursor.
That makes this the right tool for a WPF dialog, and for anything you want done while the user keeps working.
A CLIENT THAT DOES NOT LIST THIS TOOL can still reach it through
the dispatcher: tool_invoke(name="app_invoke_element", arguments={"name": "OK", "dialog_title": "Silkscreen"}).
Args: name: the element's name or automation id. A Button of that name is preferred over a label carrying the same text. dialog_title: which dialog. Empty uses the frontmost open dialog, or the main window when no dialog is open. text: set this value instead of pressing. expand: "true" or "false" to open or close a node instead.
Returns:
ok with what was done and, for a press in a dialog,
dialog_closed; or a refusal naming which pattern the
element lacks and its rectangle, so a real click remains
possible as a fallback.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| text | No | ||
| expand | No | ||
| dialog_title | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||