Michiel Posted December 15, 2014 Share Posted December 15, 2014 (edited) AutoIt v3 Window Info seems unable to provide (handle or otherwise) information about pulldown menus. Should pulldown menus always be automated using keyboard shortcuts? What if a menu option has no keyboard shortcut? Also, it seems AU3Recorder doesn't provide any code when I try to use it either for pulldown menus or anything else, really. More or less related to this post: '?do=embed' frameborder='0' data-embedContent>> Edited December 15, 2014 by Michiel Link to comment Share on other sites More sharing options...
TheSaint Posted December 15, 2014 Share Posted December 15, 2014 In my experience, some controls just don't provide access so you can read them with the Window Info Tool or allow interaction. I suspect it has to do with the type of control, and what program was used to create it, and maybe the programmer? Sometimes, you can just send text matching a menu item name, but more usually it revolves around the dicey use of ALT, TAB etc. A couple of my favorite programs give me issues like that, with some of their elements - foobar2000 & TagScanner. This issue, is the main reason I've never made my Foobar Ipod Assistant program available for download ... too inherently dangerous for those not as careful or clued in as me. No doubt someone here, knows more about it than me. I'm not conversant enough with other programming languages and that technical side of things. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Michiel Posted December 15, 2014 Author Share Posted December 15, 2014 It seems like gathering information on pulldown menu objects doesn't work on any program. Not even Notepad ... And there are a few selections in the Notepad pulldown menu which cannot be made using keyboard shortcuts. Link to comment Share on other sites More sharing options...
LarsJ Posted December 15, 2014 Share Posted December 15, 2014 It should be possible to get the menu handle in this way: #include <GuiMenu.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Example() Func Example() ConsoleWrite( "5 seconds to open a menu ..." & @CRLF ) Sleep( 5000 ) ; 5 seconds to open a menu Local $hMenu = GetMenuHandle() If Not $hMenu Then Return Local $iCount = _GUICtrlMenu_GetItemCount( $hMenu ), $sText For $i = 0 To $iCount - 1 $sText = _GUICtrlMenu_GetItemText( $hMenu, $i ) If $sText <> "" Then ConsoleWrite( $sText & @CRLF ) Next EndFunc Func GetMenuHandle() Local $hDesktop = _WinAPI_GetDesktopWindow(), $i = 0 Local $hChild = _WinAPI_GetWindow( $hDesktop, $GW_CHILD ) While $hChild And $i < 3 If _WinAPI_GetClassName( $hChild ) = "#32768" Then ExitLoop $hChild = _WinAPI_GetWindow( $hChild, $GW_HWNDNEXT ) $i += 1 WEnd If $i = 3 Then Return 0 Local $hMenu = _SendMessage( $hChild, $MN_GETHMENU ) If $hMenu > 0 Then Return $hMenu Return 0 EndFuncThe example prints menu item texts to Scite console. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
junkew Posted December 15, 2014 Share Posted December 15, 2014 try simplespy in iuiautomation thread in examples section '?do=embed' frameborder='0' data-embedContent>> FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Michiel Posted December 15, 2014 Author Share Posted December 15, 2014 Ah, of course... :-) Looks like Notepad is an MSAA provider! Link to comment Share on other sites More sharing options...
Michiel Posted December 15, 2014 Author Share Posted December 15, 2014 This may be useful, too:MSDN - "Inspect" Inspect (Inspect.exe) is a Windows-based tool that enables you select any UI element and view the element's accessibility data. You can view Microsoft UI Automation properties and control patterns, as well as Microsoft Active Accessibility properties. Inspect also enables you to test the navigational structure of the automation elements in the UI Automation tree, and the accessible objects in the Microsoft Active Accessibility hierarchy. Inspect is installed with the Windows Software Development Kit (SDK) for Windows 8. (It is also available in previous versions of Windows SDK.) It is located in the bin<platform> folder of the SDK installation path (Inspect.exe). Link to comment Share on other sites More sharing options...
junkew Posted December 17, 2014 Share Posted December 17, 2014 not sure what you mean by notepad is an MSAA provider (although it is) but menuitems in notepad are just reachable by their hwnd and normal AutoIT commands you do not neccesarily have to use IUIAutomation for notepad it just as good can be handled with AutoIT native functions FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Michiel Posted December 18, 2014 Author Share Posted December 18, 2014 Yeah, I know, just that I wasn't aware of the fact that Notepad was MSAA too 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