Search tree and select items

社会主义新天地 提交于 2019-12-04 22:52:38

It's that easy:

#include <GuiTreeView.au3>

Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", _
                                "", "[CLASS:SysTreeView32; INSTANCE:1]")

$searchText = "History"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)
While $hItemFound
   _GUICtrlTreeView_SelectItem($hWnd, $hItemFound)
   $next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound)
   $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next)
   Sleep(5000)
WEnd

By the way, you can use _GUICtrlTreeView_GetNext(...) instead for not only searching the visible next entry but the probably collapsed one as well. The ..._FindItem will search for collapsed Items anyways.

And you'd probably want to use _GUICtrlTreeView_ClickItem(...) in addition to _GUICtrlTreeView_SelectItem(...) to get the proper action performed with a selection as well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!