Try
GetMenus!
Press F1 to extract the menus of the active window to a text file.
Skrommel
;GetMenus.ahk
; Press F1 to extract the menus of the active window to a text file
;Skrommel @ 2009
#SingleInstance,Force
SetBatchLInes,-1
AutoTrim,Off
F1::
WinGet,hWnd,ID,A
wholemenu=
space=
hMenu:=DllCall("user32\GetMenu","UInt",hWnd)
GETMENU(hMenu)
FileDelete,%A_Temp%\Menus.txt
FileAppend,%wholemenu%,%A_Temp%\Menus.txt
Run,%A_Temp%\Menus.txt
Return
GETMENU(hMenu)
{
nMaxCount=100
uFlag:=0x0400 ;MF_BYPOSITION
global wholemenu
global space
menuitemcount:=DllCall("GetMenuItemCount",UInt,hMenu)
Loop,%menuitemcount%
{
nPos:=A_Index-1
VarSetCapacity(lpString,100,0) ; line inserted on 2008-02-18 -- Hope you dont mind Skrommel! - Moderator!
length:=DllCall("user32\GetMenuString","UInt",hMenu,"UINT",nPos,"STR",lpString,"int",nMaxCount,"UINT",uFlag)
wholemenu=%wholemenu%%nPos%%A_Tab%%space%%lpString%`n
hSubMenu:=DllCall("user32\GetSubMenu","UInt",hMenu,"int",nPos)
If hSubMenu>-1
{
Loop,3
space=%space%%A_Space%
GETMENU(hSubMenu)
StringTrimRight,space,space,3
}
}
Return
}