Jump to content
Sign in to follow this  
bazinguuh

Select more than 1 items after the other

Recommended Posts

bazinguuh

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

Share this post


Link to post
Share on other sites
Mat

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

Share this post


Link to post
Share on other sites
bazinguuh
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 by bazinguuh

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.