Function ControlListViewByHandle

  • Interacts with a ListView control in a window.

    Parameters

    • windowHandle: bigint

      The handle of the window to access.

    • controlHandle: bigint

      The handle of the ListView control to interact with.

    • command: ListViewCommand

      The command to execute on the ListView control. See ListViewCommand for details.

    • option1: string = ''

      Optional parameter for the command.

    • option2: string = ''

      Optional parameter for the command.

    • characterCount: number = 1024

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

    Returns string

    The result of the command as a string.

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

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

    const itemCount = ControlListViewByHandle(windowHandle, controlHandle, ListViewCommand.GetItemCount);

    console.log(itemCount); // Output: "5"