Function Reference


_GUICtrlMenu_MapAccelerator

Maps a menu accelerator key to it's position in the menu

#include <GuiMenu.au3>
_GUICtrlMenu_MapAccelerator ( $hMenu, $sAccelKey )

Parameters

$hMenu Handle to menu
$sAccelKey Accelerator key

Return Value

Success: the 0-based position of the item in the menu.
Failure: -1.

Example

#include <GuiMenu.au3>

Example()

Func Example()
    Local $hWnd, $hMain, $hFile

    ; Open Notepad
    Run("notepad.exe")
    WinWaitActive("[CLASS:Notepad]")
    $hWnd = WinGetHandle("[CLASS:Notepad]")
    $hMain = _GUICtrlMenu_GetMenu($hWnd)
    $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

    ; Map Open accelerator ID
    Writeln("Open command ID: " & _GUICtrlMenu_MapAccelerator($hFile, "O"))
EndFunc   ;==>Example

; Write a line of text to Notepad
Func Writeln($sText)
    ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CRLF)
EndFunc   ;==>Writeln