# 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 "Extras\HelpFileInternals.au3"

    #include <GuiMenu.au3>

    Global $g_hWnd

    Example()

    Func Example()
        Local $hMain, $hFile

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

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

        _NotepadForceClose($g_hWnd)
    EndFunc   ;==>Example

    ; Write a line of text to Notepad
    Func Writeln($sText, $hWnd = $g_hWnd)
        ControlSend($hWnd, "", ControlGetFocus($hWnd), $sText & @CRLF)
    EndFunc   ;==>Writeln