@ahmic/autoit-js
Version:
Node.js bindings for AutoItX3.dll
83 lines (82 loc) • 2.67 kB
TypeScript
/**
* Enumeration for window properties.
*/
export declare enum WindowProperty {
/** Indicates if the window exists. */
Exists = 1,
/** Indicates if the window is visible. */
Visible = 2,
/** Indicates if the window is enabled. */
Enabled = 4,
/** Indicates if the window is active. */
Active = 8,
/** Indicates if the window is minimized. */
Minimized = 16,
/** Indicates if the window is maximized. */
Maximized = 32
}
/**
* The decoded state of a window.
*/
export type WindowState = {
/** Indicates if the window exists. */
exists: boolean;
/** Indicates if the window is visible. */
visible: boolean;
/** Indicates if the window is enabled. */
enabled: boolean;
/** Indicates if the window is active. */
active: boolean;
/** Indicates if the window is minimized. */
minimized: boolean;
/** Indicates if the window is maximized. */
maximized: boolean;
};
/**
* Returns the state of a window.
*
* Though the original AutoIt function returns a bitmask, this function returns an object with boolean
* properties for each state for ease of use.
*
* @param windowTitle The title of the window to check.
* @param windowText Optional text found in the window.
*
* @returns A {@linkcode WindowState} object containing the state of the window.
*
* @example
* ```typescript
* import { WinGetStateSync } from '@ahmic/autoit-js';
*
* const state = WinGetStateSync('Untitled - Notepad');
*
* console.log(state.exists); // true if the window exists
* console.log(state.visible); // true if the window is visible
* ```
*
* @see https://www.autoitscript.com/autoit3/docs/func/WinGetState.htm
*/
export declare function WinGetStateSync(windowTitle: string, windowText?: string): WindowState;
/**
* Returns the state of a window.
*
* Though the original AutoIt function returns a bitmask, this function returns an object with boolean
* properties for each state for ease of use.
*
* @param windowTitle The title of the window to check.
* @param windowText Optional text found in the window.
*
* @returns A promise that resolves to a {@linkcode WindowState} object containing the state of the window.
*
* @example
* ```typescript
* import { WinGetState } from '@ahmic/autoit-js';
*
* const state = await WinGetState('Untitled - Notepad');
*
* console.log(state.exists); // true if the window exists
* console.log(state.visible); // true if the window is visible
* ```
*
* @see https://www.autoitscript.com/autoit3/docs/func/WinGetState.htm
*/
export declare function WinGetState(windowTitle: string, windowText?: string): Promise<WindowState>;