HarshChaturvedi Posted October 26, 2013 Share Posted October 26, 2013 Hi , I am working on a gui which involves arranging items by drag and drop. The variables respective to each item can be changed by right clicking on the item and choosing an option from the drop down menu. Now since drop down menu doesn't have a title bar how do i get hold of the sub items in the menu?? Please help guys .. Thanks in advance . Link to comment Share on other sites More sharing options...
l3ill Posted October 26, 2013 Share Posted October 26, 2013 I'm just stabbing at vagueness here: To click on a drop down menu item use ControlClick Right and maneuver up & down with the arrow keys and finally enter My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Iczer Posted October 26, 2013 Share Posted October 26, 2013 Just right-click where you need (to make context menu appear) a then run this function: #include <WindowsConstants.au3> #include <SendMessage.au3> #include <GuiMenu.au3> Func Click_RightClickMenu($sRequired_Text = "") Local $previousMousePos, $hWnd, $hMenu, $iCount, $iIndex, $sText, $aPos, $iOldOpt $previousMousePos = MouseGetPos() If $sRequired_Text = "" Then Return SetError(1) If WinExists("[CLASS:#32768]") Then $hWnd = WinGetHandle("[CLASS:#32768]") $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0) If _GUICtrlMenu_IsMenu($hMenu) Then $iCount = _GUICtrlMenu_GetItemCount($hMenu) For $iIndex = 0 To $iCount - 1 $sText = StringReplace(_GUICtrlMenu_GetItemText($hMenu, $iIndex),"&","") If $sText == $sRequired_Text Then $aPos = _GUICtrlMenu_GetItemRect($hWnd, $hMenu, $iIndex) $iOldOpt = Opt("MouseCoordMode", 0) MouseClick("primary", $aPos[0] + ($aPos[2] - $aPos[0]) / 10, $aPos[1] + ($aPos[3] - $aPos[1]) / 2, 1, 1) Opt("MouseCoordMode", $iOldOpt) EndIf Next EndIf EndIf Sleep(10) MouseMove($previousMousePos[0], $previousMousePos[1], 0) EndFunc ;==>Click_RightClickMenu Where $sRequired_Text - is the name of the menu item you want to click 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