bazinguuh Posted June 19, 2013 Share Posted June 19, 2013 Hi, I am trying to select items with "Win" in its name. However, How about if it has to search texts with "History" AND "Win" at the same time? Thanks _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 Link to comment Share on other sites More sharing options...
Mat Posted June 19, 2013 Share Posted June 19, 2013 You have to do two searches at the same time, and compare the indexes using _GUICtrlTreeView_Index. You use the item with the lower index as $hItemFound. In pseudo code: While foundItem Select(foundItem) nextItem = GetNextVisible() foundWinItem = FindItem("Win") foundHistoryItem = FindItem("History") If Index(foundWinItem) < Index(foundHistoryItem) Then foundItem = foundWinItem Else foundItem = foundHistoryItem EndIf WEnd AutoIt Project Listing Link to comment Share on other sites More sharing options...
bazinguuh Posted June 20, 2013 Author Share Posted June 20, 2013 (edited) While foundItem Select(foundItem) nextItem = GetNextVisible() foundWinItem = FindItem("Win") foundHistoryItem = FindItem("History") If Index(foundWinItem) < Index(foundHistoryItem) Then foundItem = foundWinItem Else foundItem = foundHistoryItem EndIf WEnd This works somehow, but it skips other items with win or history though. Edited June 20, 2013 by bazinguuh Link to comment Share on other sites More sharing options...
Mat Posted June 20, 2013 Share Posted June 20, 2013 Again, please don't duplicate your question over different sites. Especially when it's the same people in both places Answered here: http://stackoverflow.com/questions/17203903/selecting-more-than-one-item-in-a-tree#answer-17209072 AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now