GetTreeNode


 

GetTreeNode>WindowTitle,ClassName,Instance,Text,Case,Partial,Result,Handle

 

Returns in Result the index of the visible tree view node whose caption matches Text.

 

WindowTitle: The title of the window containing the TreeView object

ClassName: Usually SysTreeView32 but may differ.  Use View System Windows to determine class name.

Instance: The zero based index of the instance to use (a window may contain several treeview objects).

Text: The text to search for in the list box.

Case: 1 to perform a case sensitive match, 0 for non-case sensitive.

Partial: 1=partial, 0=full.  A partial match will match Text at the start of the item text.

Result: Gets set to the zero based index of the item or -1 if not found.

Handle: Gets set to the handle of the TreeView object.

 

The zero based index of the node is returned in Result.  Handle will be set to the handle of the ListView object.  Only visible nodes are searched.

 

WindowTitle can end with an asterisk to indicate a substring match.  WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted.  See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.

 

Abbreviation: GTN

See also: GetListItem

 

Example

 

This example uses GetTreeNode to retrieve the index of an item in Explorer's Folders treeview.

 

//Assumes Windows Explorer is open at "My Documents" with
 //explorer bar showing Folders
 GetTreeNode>My Documents,SysTreeView32,0,My Computer,1,1,result,handle
  
 Let>WIN_USEHANDLE=1
 SetFocus>handle
 Let>WIN_USEHANDLE=0
  
 Press Home
 Press Down * result
 Press Right