1

ここに、名前に「Win」が含まれるアイテムを検索して選択するコードがあります。しかし、名前に「Win」、「History」、「Credits」、または「#」が含まれるアイテムを検索して選択するように変更する必要があります。ありがとう!

_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
4

1 に答える 1