Jump to content
Sign in to follow this  

Select Item from a treeView

Recommended Posts


I just started to use Autoit v3, it is awesome.

Have a window (Color Selection) with a treeview







I do not want to use the {TAB} or {DOWN} because the number of the colors changes


The Au Window info show

>>>> Control <<<<
Class: SysTreeView32
Instance: 1
ClassnameNN: SysTreeView321
Advanced (Class): [CLASS:SysTreeView32; INSTANCE:1]
ID: 59648
Position: 2, 88
Size: 356, 125
ControlClick Coords: 80, 36
Style: 0x50800027
ExStyle: 0x00000000
Handle: 0x000000000073027A

The Title of Basic windows is ="Color Selection" , class SysTreeView32

#include <GuiTreeView.au3>

.. code that actually navigates to the Color selection window not shown jut to keep the post cleaner

I am using the ControlTreeView as follows

ControlTreeView("Color Selection", "", "SysTreeView321", "Select", "RED|Red1")

I have also try to ensue the window is active before the ControlTreeView (e.g. WinWaitActive ("Color Selection") but still no luck.

Can any body show me how to Select RED1 item?

Your help is greatly appreciated

Edited by Picasso51

Share this post

Link to post
Share on other sites

I have tried this code in a windows form application and works fine. 


Global $hWnd = ControlGetHandle("[CLASS:WindowsForms10.Window.8.app3   ;TITLE:MyApplication]", _
                                "", "[CLASS:SysTreeView32; INSTANCE:1]")

$searchText = "About"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)
While $hItemFound
 _GUICtrlTreeView_SelectItem($hWnd, $hItemFound)
$next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound)
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next)

However, when I used on the Color Selector application (original post), I have noticed that the parent class keeps changing according to AutoItv3 Window info

one time will show CLASS:Afx:00400000:8:00010003:00000000:06FF0471

next is CLASS:Afx:00400000:8:00010003:00000000:06CF04A1  ..etc

what other options can I used?

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