Function WinMenuSelectItemByHandle

  • Selects a menu item in a window.

    Underlined items in the menu must be selected using the & prefix. For example, if you're following the sequence File -> Open, you would use &File and &Open in the parameters.

    Parameters

    • windowHandle: bigint

      The handle of the window containing the menu.

    • item1: string

      The text of the first-level menu item.

    • item2: string = ''

      Optional text of the second-level menu item.

    • item3: string = ''

      Optional text of the third-level menu item.

    • item4: string = ''

      Optional text of the fourth-level menu item.

    • item5: string = ''

      Optional text of the fifth-level menu item.

    • item6: string = ''

      Optional text of the sixth-level menu item.

    • item7: string = ''

      Optional text of the seventh-level menu item.

    • item8: string = ''

      Optional text of the eighth-level menu item.

    Returns number

    1 if successful, 0 otherwise.

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

    const windowHandle = WinGetHandle('Untitled - Notepad');

    WinMenuSelectItemByHandle(windowHandle, 'File', 'Open');