jdegraff Posted September 1, 2019 Share Posted September 1, 2019 (edited) I'm trying to get the names if the items in a TreeView control. I have the control ID (200864) and I can get the item count but I can't get at the actual items. The best I've been able to manage is to get the item reference. As you can see I am able to determine that items #0 through #3 exist. But when I try to get the text I get nothing. Similarly, when I select an item and try to fetch it I get only the item reference. How can I get at the actual text items? Screen snaps are attached. Code ==== import os import win32com.client aut_MatchFromStart = 1 id = 200864 win = "Batch" aut = win32com.client.Dispatch("AutoItX3.Control") aut.Opt("WinTitleMatchMode", aut_MatchFromStart) print("ItemCount=",aut.ControlTreeView(win,"",id,"GetItemCount","","")) for i in range(0,5): item = "#" + str(i) print("item",i,"exists=",aut.ControlTreeView(win,"",id,"Exists",item,"")) print("GetText #0 = <%s>" % aut.ControlTreeView(win,"",id,"GetText","#0","")) print("Select result=",aut.ControlTreeView(win,"",id,"Select",0,"")) print("GetSelected= <%s>" % aut.ControlTreeView(win,"",id,"GetSelected",0,"")) print("GetSelected= <%s>" % aut.ControlTreeView(win,"",id,"GetSelected",0,1)) Output ====== ItemCount= 4 item 0 exists= 1 item 1 exists= 1 item 2 exists= 1 item 3 exists= 1 item 4 exists= 0 GetText #0 = <> Select result= 1 GetSelected= <#0> GetSelected= <#0> Edited September 1, 2019 by jdegraff typo Link to comment Share on other sites More sharing options...
Developers Jos Posted September 1, 2019 Developers Share Posted September 1, 2019 (edited) How is this thread different from Which you posted more than a year ago? Does that mean you never solved it and though: "let's try again"? Jos EDIT: ... and I see you also reported your own thread to delete it .... sweet, wel we don't delete threads unless they are in violation of some rules, so *click* Edited September 1, 2019 by Jos Nine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts