kamyers1 Posted September 10, 2009 Posted September 10, 2009 I may be missing the obvious, but it is unclear to me how to navigate the nodes in a treeview control using the ControlTreeView commands available in AutoItX. I have a treeview with nodes that are two levels deep, and I need to select one of the leaf nodes based on a text value for the parent node and separate text value for the child node. There can be duplicate text for leaf nodes with different parent nodes. So basically, I need to find the parent node based on a text value, then find a leaf node for that parent node based on a different text value, then select that leaf node. Can someone please provide an example of how to do this? Since I am posting this in the ActiveX/COM forum, hopefully it is obvious that I need to do this using AutoItX. Thanks, Kevin M.
kamyers1 Posted September 10, 2009 Author Posted September 10, 2009 Well I thought I had this figured out, but guess that I don't after all. In the very first case that I tested, I have a listview that looks as follows: There is a single top level item with the text Exports, and eleven second level items beneath that. When I try the following code, what gets printed is 0 (zero). wscript.echo AutoIt.ControlTreeView("Output", "", "TreeView20WndClass3", "Exists", "Exports", "") I have double, triple, and quadruple checked the text (spelling, case, no blank padding, etc.) for the window, the treeview control, and the item in the tree. They all appear to be exactly as listed in the above statement. Based on clicking on the items so that they are highlighted, there don't appear to be any extraneous blanks that could be confusing things. Based on my reading of the docs, I thought that function call should return a 1, since a top level node with the text "Exports" *does* exist. What am I doing wrong? Thanks, Kevin M.
kamyers1 Posted September 10, 2009 Author Posted September 10, 2009 (edited) Still needing some help on this. Is anyone out there??? I tried the following series of statements: wscript.echo "control=" & control wscript.echo "OutType=" & OutType wscript.echo "IsVisible=" & AutoIt.ControlCommand("Output", "", control, "IsVisible", "") wscript.echo "error=" & AutoIt.error wscript.echo "IsEnabled=" & AutoIt.ControlCommand("Output", "", control, "IsEnabled", "") wscript.echo "error=" & AutoIt.error wscript.echo "Exists=" & AutoIt.ControlTreeView("Output", "", control, "Exists", OutType, "") wscript.echo "error=" & AutoIt.error wscript.echo "Exists=" & AutoIt.ControlTreeView("Output", "", "TreeView20WndClass3", "Exists", "Exports", "") wscript.echo "error=" & AutoIt.error wscript.echo "GetItemCount=" & AutoIt.ControlTreeView("Output", "", "TreeView20WndClass3", "GetItemCount", "Exports", "") wscript.echo "error=" & AutoIt.error wscript.echo "GetText=" & AutoIt.ControlTreeView("Output", "", "TreeView20WndClass3", "GetText", "#0", "") wscript.echo "error=" & AutoIt.error wscript.echo "GetText=" & AutoIt.ControlTreeView("Output", "", "TreeView20WndClass3", "GetText", "#0|#0", "") wscript.echo "error=" & AutoIt.error Here are the results: control=TreeView20WndClass3 OutType=Exports IsVisible=1 error=0 IsEnabled=1 error=0 Exists=0 error=0 Exists=0 error=0 GetItemCount=0 error=0 GetText= error=1 GetText= error=1 P.S. - I think that this problem may have something to do with the fact that this treeview control is located within a tab control. One of the other tabs has a listview conrol, and I am also having problems reading the text from items in that listview, whereas I have been able to read text from other listview controls not located within tab controls without difficulty. Is there something special that I need to do in order to deal with treeview and listview controls when they are located within a tab control? Edited September 10, 2009 by kamyers1
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