da_window_focus
Focus a target OS window by handle or title substring, optionally narrowed by PID, so subsequent mouse and keyboard actions land on it.
Instructions
Bring a top-level OS window to the foreground so subsequent da_click / da_type / da_key land on it. Resolves the window either by hwnd (exact match) or by a case-insensitive substring of its title (optionally narrowed by pid). bringToTop: true (default) also calls SetWindowPos(HWND_TOP) on Windows so the window is at the top of the Z-order. Returns { hwnd, pid, title, foreground } where foreground: false indicates the OS refused the foreground change (e.g. another process holds the foreground lock on Windows). Throws NOT_FOUND when no visible window matches. Linux requires wmctrl on PATH; macOS uses osascript; Windows uses PowerShell + Win32 SetForegroundWindow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | ||
| hwnd | No | ||
| title | No | ||
| bringToTop | No |