Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver-rs/windows): more honest hotkey no-match error message (#1612)

Francesco Bonacci8003993f82f1
diff --git a/libs/cua-driver-rs/crates/platform-windows/src/tools/impl_.rs b/libs/cua-driver-rs/crates/platform-windows/src/tools/impl_.rs
index 8242ba4fea..4c3dcb5eff 100644
--- a/libs/cua-driver-rs/crates/platform-windows/src/tools/impl_.rs
+++ b/libs/cua-driver-rs/crates/platform-windows/src/tools/impl_.rs
@@ -1588,12 +1588,15 @@ impl Tool for HotkeyTool {
)),
Ok(Ok((false, scanned))) => ToolResult::error(format!(
"hotkey on a modern XAML / UWP target (pid {raw_pid}, hwnd {hwnd}) \
- could not find a descendant UIA AcceleratorKey matching \
- `{key_display_for_result}` (scanned {scanned} element(s)). \
+ could not find a UIA AcceleratorKey or `(Ctrl+X)`-style name hint \
+ matching `{key_display_for_result}` (scanned {scanned} element(s)). \
PostMessage WM_KEYDOWN/UP is ignored by this target's input pipeline. \
- Call `get_window_state(pid={raw_pid}, window_id={hwnd})` to inspect \
- available UIA actions, then use an exposed accelerator or invoke/click \
- the matching element."
+ Common cause: the action is nested behind a closed menu (e.g. modern \
+ Notepad's Save under the File menu) — its element isn't in the visible \
+ subtree until the menu is opened. Call \
+ `get_window_state(pid={raw_pid}, window_id={hwnd})` to inspect available \
+ UIA actions, then use an exposed accelerator or `click` the matching \
+ element directly."
)),
Ok(Err(e)) => ToolResult::error(format!("hotkey (UIA path): {e}")),
Err(e) => ToolResult::error(format!("Task error: {e}")),