我在这里有一个代码,它的名称中搜索并选择了一个“Win”项目。但是我必须修改它来搜索其名称中包含“赢”,“历史”,“积分”或“#”的项目并选择它。谢谢!选择树中的多个项目
_GUICtrlTreeView_Expand(ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]","", "[CLASS:SysTreeView32; INSTANCE:1]"),0, True)
Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]")
$searchText = "Win"
$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(1000)
WEnd
我也使用switch
尝试,但都不行:
Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]")
$searchText = "Autoit"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)
While $hItemFound
_GUICtrlTreeView_SelectItem($hWnd, $hItemFound)
$next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound)
$foundWinItem = _GUICtrlTreeView_FindItem($hWnd, "Win", True,$next)
$foundHistoryItem = _GUICtrlTreeView_FindItem($hWnd, "History", True,$next)
Switch $next
Case "Win"
$hItemFound = $foundWinItem
Case "History"
$hItemFound = $foundHistoryItem
EndSwitch
WEnd
我不知道,如果你是知道的,但我的人谁回答堆栈溢出AutoIt的问题,极少数中的一个。我也是在autoit论坛上帮助你的人。在两者之间复制你的问题不会让你得到任何地方。请耐心等待,并在自动论坛上重新阅读我的答案,因为您错误地实施了这个答案。 – Matt