bazinguuh Posted June 13, 2013 Share Posted June 13, 2013 (edited) Hi @all, I am new to autoIT. I am trying to collapse the parent tree of autoit help file as shown in the picture below. Should be an index of that tree is used so it can identify which will collapse? EDIT: Or maybe Expand all? I know how to expand a tree in a "created GUI". But in a file such as this, I do not know... #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> $file = FileGetShortName("C:\Users\PHSD100-SIC\Desktop\AutoIt3.chm") RunWait(@ComSpec & " /c start " & $file) $class_treeview = "[CLASS:SysTreeView32; INSTANCE:1]" ControlTreeView('[CLASS:HH Parent]', '', '[CLASS:SysTreeView32; INSTANCE:1]', 'Collapse All', 0) If @error Then MsgBox(4096, "Test", "Item not collapse", 10) EndIf Edited June 13, 2013 by bazinguuh Link to comment Share on other sites More sharing options...
TheSaint Posted June 13, 2013 Share Posted June 13, 2013 (edited) I'm not that familiar with using ControlTreeView, but in the online help, there is no 'Collapse All', it is only 'Collapse', with perhaps an additional parameter needed? You also have a parameter of '0' which seems inappropriate to me ... either leave that off altogether, or provide the appropriate item Header?? if required. Edited June 13, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
bazinguuh Posted June 13, 2013 Author Share Posted June 13, 2013 How about expanding only the TUTORIALS tree? I have tried this code but did not work: _GUICtrlTreeView_Expand(ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]"), 2, True) Link to comment Share on other sites More sharing options...
bazinguuh Posted June 14, 2013 Author Share Posted June 14, 2013 (edited) It's a bit more complicated than that. This code will do it. #include <GuiTreeView.au3> Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]") Global $hChild = _GUICtrlTreeView_GetFirstChild($hWnd, 0) While 1 Sleep(10) $hChild = _GUICtrlTreeView_GetNextChild($hWnd, $hChild) If _GUICtrlTreeView_GetText($hWnd, $hChild) = "Tutorials" Then ExitLoop WEnd _GUICtrlTreeView_Expand(ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]"), $hChild, True) THANKS. This works perfectly. However, I have another question: I have to select an item under the tree and double click it. Here is my code for selecting an item: or I could pass the items to array? _GUICtrlTreeView_SelectItem( $hWnd, $hChild[3]) Edited June 14, 2013 by bazinguuh 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