Method Reference
ControlTreeView
Sends a command to a TreeView32 control
ControlTreeView "title", "text", "controlID", "command", "option1", "option2"
Parameters
| title | The title of the window to access. |
| text | The text of the window to access. |
| controlID | The control to interact with. See Controls. |
| command | The command to send to the control (see below). |
| option1 | Additional parameter required by some commands; use "" if parameter is not required. |
| option2 | Additional parameter required by some commands; use "" if parameter is not required. |
Return Value
Depends on command as table below shows. In case of an error (such as an invalid command or window/control could not be found) then @error is set to 1.| Command, Option1, Option2 | Operation |
| "Check", "item" | Checks an item (if the item supports it). |
| "Collapse", "item" | Collapses an item to hide its children. |
| "Exists", "item" | Returns 1 if an item exists, otherwise 0. |
| "Expand", "item" | Expands an item to show its children. |
| "GetItemCount", "item" | Returns the number of children for a selected item. |
| "GetSelected" [, UseIndex] | Returns the item reference of the current selection using the text reference of the item (or index reference if UseIndex is set to 1). |
| "GetText", "item" | Returns the text of an item. |
| "IsChecked" | Returns the state of an item. 1:checked, 0:unchecked, -1:not a checkbox. |
| "Select", "item" | Selects an item. |
| "Uncheck", "item" | Unchecks an item (if the item supports it). |
Related
ControlClick, ControlCommand, ControlDisable, ControlEnable, ControlFocus, ControlGetPosX, ControlGetPosY, ControlGetText, ControlHide, ControlListView, ControlMove, ControlSetText, ControlShow, StatusbarGetText, WinGetClassList, WinMenuSelectItem
Example
Set oAutoIt = WScript.CreateObject("AutoItX3.Control") oAutoIt.ControlListView "C:\", "", "SysTreeView321", "SelectAll", "", "" oAutoIt.ControlListView "C:\", "", "SysTreeView321", "Deselect", "2", "5"