Send("{DOWN}") on a context menu doesn't work everytime

52 views Asked by At

I am automating Eclipse IDE on a Windows 10 system. I need to search for "QueueManagers" in a SysTreeView32, select it, right-click it to open the context menu and move to "Open in new window". AutoIt Window Information Tool shows only class of the context menu.

inspect tool image

So I used Send("{DOWN}") three times. This sometimes doesn't start from top of context menu and chooses the wrong option:

#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiTreeView.au3>

WinActivate("eclipse-workspace - Trial/src/module-info.java - Eclipse IDE")
Sleep(1000)

Local $hWnd = ControlGetHandle("eclipse-workspace - Trial/src/module-info.java - Eclipse IDE", "", "SysTreeView321")
;MsgBox(0, "Handle", $hWnd)
Sleep(1000)

Local $searchText = "QueueManagers"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText)
;MsgBox(0, "Result", $hItemFound)

If $hItemFound Then
    Sleep(1000)
    _GUICtrlTreeView_ClickItem($hWnd, $hItemFound)
    _GUICtrlTreeView_ClickItem($hWnd, $hItemFound, "right")

    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
EndIf

Using Sleep() I got the same results. How to make Send("") start from top? Is there another way to search for "Open in new window" in the context menu and click that?

0

There are 0 answers