Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Selecting a context menu item

$
0
0

Hi,
 
 Following my question here, how do I select a menu item according to its text?
 
 I tried the following (please see also comments embedded):

 

AutoIt         
If WinExists("[CLASS:#32768") Then     $hWnd = WinGetHandle("[CLASS:#32768") ;ContextMenu     $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0)     If _GUICtrlMenu_IsMenu($hMenu) Then         ConsoleWrite("$menuItemText = " & $menuItemText & @CRLF) ;That is the text I am searching in the menu..         $menuItemsCount = _GUICtrlMenu_GetItemCount($hMenu)         ConsoleWrite("$menuItemsCount = " & $menuItemsCount & @CRLF)         For $i = 0 To $menuItemsCount - 1 ;By the way I tried with FindItem and failed..             $itemText = _GUICtrlMenu_GetItemText($hMenu, $i)             ConsoleWrite("$itemText = " & $itemText & @CRLF)             If $itemText = $menuItemText Then                 Sleep(1000)                 ConsoleWrite("{ENTER}")                 Send("{ENTER}") ;Well, this wouldn't work of course because I didn't select an item. I think I could use here something like "selectItem (text) " before the "ENTER"                 Return True             EndIf         Next         ConsoleWrite("Didn't find " & $menuItemText & " in menu" & @CRLF)         Return False     EndIf EndIf

 

 

 
Thanks!


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>