Function ControlCommandByHandle

  • Sends a command to a control in a window.

    Parameters

    • windowHandle: bigint

      The handle of the window to access.

    • controlHandle: bigint

      The handle of the control to send the command to.

    • command: Command

      The command to send to the control.

    • option: string = ''

      Optional additional parameter for the command.

    • characterCount: number = 1024

      The size of the buffer to store the result.

    Returns string

    The result of the command as a string.

    import { ControlCommandByHandle, WinGetHandle, ControlGetHandle } from '@ahmic/autoit-js';

    const windowHandle = WinGetHandle('Untitled - Notepad');
    const controlHandle = ControlGetHandle(windowHandle, 'Edit1');
    const result = ControlCommandByHandle(windowHandle, controlHandle, 'IsVisible');

    console.log(result); // Output: "1" if visible, "0" otherwise