ControlClick chooses the wrong context menu item

34 views Asked by At

Using AutoIt I need to right-click which opens a context menu and then select the 6th item. Send("{}") chooses randomly. AutoIt Window Information Tool shows only [CLASS:#32768] about the context menu.

I found another solution:

Local $putMsgHandle = WinGetHandle ( "[CLASS:#32768]" )
Local $putMsgMenu  =  _SendMessage ( $putMsgHandle ,  $MN_GETHMENU ,  0 ,  0 )
Local $putMsgRect  =  _GUICtrlMenu_GetItemRect ($putMsgHandle, $putMsgMenu, 6)
ControlClick("[CLASS:#32768]", "", "", "left", 1,  $putMsgRect[0], $putMsgRect[1])

This works but sometimes chooses the wrong option. While executing there was no mouse movement, keyboard or pop-up. The application to be tested was the only one open.

0

There are 0 answers