Function ControlGetTextByHandle

  • Retrieves the text from a control in a window.

    Parameters

    • windowHandle: bigint

      The handle of the window to access.

    • controlHandle: bigint

      The handle of the control to retrieve text from.

    • characterCount: number = 1024

      The maximum number of characters to retrieve. Default is 1024.

    Returns string

    The text of the control.

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

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

    const text = ControlGetTextByHandle(windowHandle, controlHandle);

    console.log(text); // Output: "Sample text"