Sign in to follow this  
Followers 0
Fixis

Recognition of different menu items

3 posts in this topic

Hello everyone,

Let's say I open Notepad and I click "File" on the menu and a dropdown list appears. If I click on "Edit" a different dropdown will appear. Is there a way for Autoit to find out if the "File" or "Edit" dropdown menu is currently on the screen? Thank you.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hope this helps you.

#include <GuiMenu.au3>
While 1
   Sleep(10)
   If WinActive("[CLASS:Notepad]") Then ;Makes sure not any active ContextMenu is accepted
   If WinExists("[CLASS:#32768]") Then ;Makes sure it is a ContextMenu.
   $SomeName = _GUICtrlMenu_GetMenuBarInfo(WinGetHandle("[CLASS:#32768]" ), 0, 0)
   MsgBox(64,"Information about the current ContextMenu",$SomeName[0]&" - X coordinate of the upper left corner of the rectangle"&@CRLF& _
   $SomeName[1]&" - Y coordinate of the upper left corner of the rectangle"&@CRLF& _
   $SomeName[2]&" - X coordinate of the lower right corner of the rectangle"&@CRLF& _
   $SomeName[3]&" - Y coordinate of the lower right corner of the rectangle"&@CRLF& _
   $SomeName[4]&" - Handle to the menu bar or popup menu"&@CRLF& _
   $SomeName[5]&" - Handle to the submenu"&@CRLF& _
   $SomeName[6]&" - True if the menu bar has focus, otherwise False"&@CRLF& _
   $SomeName[7]&" - True if the menu item has focus, otherwise False"&@CRLF)
   EndIf
   EndIf
WEnd
Edited by Aipion

Share this post


Link to post
Share on other sites

Astounding! Thank you, Aipion

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0