A snapshot of the foreground window, or null when no focusable window is active.
Finds all visible windows matching the given filter criteria.
Optionalquery: WindowQuery | null
Object with optional title and/or process filters. Omit or pass null to return every visible top-level window.
An array of matching WindowInfo objects. Empty array if none match.
The title filter is treated as a regular expression when valid, falling back to substring match if the pattern is invalid. The process filter is always a case-insensitive substring match on the executable name.
Captures a bounded best-effort snapshot of a top-level window and its classic controls.
Optionaloptions: WindowInspectOptions | null
Target, locked-window, and text-retrieval options. Omit or pass null for cursor targeting with fast text.
Resolves with a snapshot, or null if no target window can be resolved.
The cursor is sampled once by the host before target resolution. Cursor mode scans targetable top-level windows in z-order using cached rectangles plus a bounded native hit test; shaped and per-pixel layered surfaces remain best-effort, and a hit-test timeout conservatively selects that candidate. Foreground mode selects the active window, and windowId keeps a previously selected window locked. Every mode resolves the control under the sampled cursor within its target. Controls detected as password-style at either text-retrieval boundary are redacted. textPartial signals known or possible incompleteness from best-effort cross-process reads, redaction, timeout, truncation, access denial, or controls disappearing during capture.
Brings the specified window to the foreground.
The id from a WindowInfo object.
true if the window was successfully focused.
Moves a window to an absolute physical virtual-screen position and optionally resizes its outer bounds.
The id from a WindowInfo object.
Absolute new left edge.
Absolute new top edge.
Optionalw: number
Positive signed-32-bit outer width. Omit to keep the current width.
Optionalh: number
Positive signed-32-bit outer height. Omit to keep the current height.
true if the operation succeeded.
x and y set the outer window's top-left corner; they are not relative offsets. The signed coordinate space is shared with Mouse, Screen, and overlays, so monitors left of or above the primary monitor use negative values. Width and height are physical pixels and are not DPI-scaled.
Sends a close request (WM_CLOSE) to the specified window. The window may prompt the user before closing.
The id from a WindowInfo object.
Registers a callback that fires whenever a different window becomes the foreground window. The script enters an event loop and stays alive as long as this handler is registered.
Handler receiving the newly activated window's WindowInfo, or null if it closed before dispatch.
Returns information about the currently active (foreground) window, or
nullif no window is focused.