MattHiggs Posted July 30, 2019 Share Posted July 30, 2019 (edited) Hey all. So I have a question. I am trying to use "winmenuselectitem" to select a menu item, but I am running into some difficulty actually matching the text of the menu item. As you all are already abundantly aware, the autoit help file indicates that an underlined character in the text of a menu item should be preceded by a "&." I don't know if this is a configuration that one can enable somewhere, but I am not seeing any underlined characters in the text of any of the menu list items. And I know that there have to be some there, as, when I open notepad to run the example provided in the autoit help file, the example would indicate that the "F" in File and "u" in Setup are both underlined, but, as you can see below, these characters are not underlined. Furthermore, as one would expect, running the help file example does perform the intended action. So, I need one of two things: 1) if someone could inform me as to how I enable whatever view lets me see the underlined characters, or 2) inform me as to how I can go about determining the correct characters that make up the strings of the menu items. I would greatly appreciate it. Edited July 30, 2019 by MattHiggs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 30, 2019 Moderators Share Posted July 30, 2019 Usually on the top level menu, if you hold the ALT key down, it will display the trigger keys: MattHiggs 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MattHiggs Posted July 30, 2019 Author Share Posted July 30, 2019 1 minute ago, JLogan3o13 said: Usually on the top level menu, if you hold the ALT key down, it will display the trigger keys: Interesting, @JLogan3o13. Did not know that. But only the top level menu item? How do you determine if any non-top level menu item has underlined characters? Link to comment Share on other sites More sharing options...
jdelaney Posted July 30, 2019 Share Posted July 30, 2019 (edited) Example of looping a menu, and looping through a child menu, to get what you need: #include <GuiMenu.au3> $hwnd = WinGetHandle("[CLASS:Notepad]") WinActivate($hwnd) $hMenu = _GUICtrlMenu_GetMenu($hwnd) $iFile = _GUICtrlMenu_FindItem($hMenu, "File") $hFileMenu = _GUICtrlMenu_GetItemSubMenu($hMenu, $iFile) For $i = 0 To _GUICtrlMenu_GetItemCount($hMenu) - 1 ConsoleWrite(_GUICtrlMenu_GetItemText($hMenu,$i) & " " & @error & @CRLF) Next ConsoleWrite($hFileMenu & @CRLF) For $i = 0 To _GUICtrlMenu_GetItemCount($hFileMenu) - 1 ConsoleWrite("text=[" & _GUICtrlMenu_GetItemText($hFileMenu,$i, True) & "] " & @error & @CRLF) Next &File 0 &Edit 0 F&ormat 0 &View 0 &Help 0 0x000E0869 text=[&New Ctrl+N] 0 text=[&Open... Ctrl+O] 0 text=[&Save Ctrl+S] 0 text=[Save &As...] 0 text=[] 0 text=[Page Set&up...] 0 text=[&Print... Ctrl+P] 0 text=[] 0 Edited July 30, 2019 by jdelaney FrancescoDiMuro 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 30, 2019 Moderators Share Posted July 30, 2019 It is not just the top level. Using your Notepad example, try it out: MattHiggs 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MattHiggs Posted July 30, 2019 Author Share Posted July 30, 2019 Thanks for the help gents. Got it working. appreciate the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now