bobetko Posted May 4, 2007 Share Posted May 4, 2007 I am trying to automate some task and I hit the wall, a TreeView. How select an item in the treeview? For example, through script I've just added new item called "newItem". Now, I want to find and select this item. I tried $n = ControlCommand("FACSys Desktop", "", "SysTreeView321", "SelectString", 'newItem') It didn't work. Thanks, Link to comment Share on other sites More sharing options...
Kip Posted May 4, 2007 Share Posted May 4, 2007 Read the wonderfull help file that was installed with autoit. User Defined Function > GuiTreeView Management MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
bobetko Posted May 4, 2007 Author Share Posted May 4, 2007 Thanks for your response Kip.For last couple of day I am not doing anything besides reading help files. The problem is I am not trying to create new treeview control. I am trying to automate process of installing phonebooks in my FAX application at work. The process consists of pointing to source(database file), then new phonebook item is added to treeview control (this treeview is control in the FAX application that I am trying to automate). This new phonebook items would have generic names like noname01, noname02,...etc.So I will repeat my question: How to find item in the treeview control named "noname01" and do right-mouse-click on it?These are control information from AutoIt Widnow Info:Control ID: 59648ClassNameNN: SysTreeView321In the help I found ControlListView. I need something like this for treeview. I played with ControlCommand, but it does not work.Thanks,Read the wonderfull help file that was installed with autoit.User Defined Function > GuiTreeView Management Link to comment Share on other sites More sharing options...
Kip Posted May 4, 2007 Share Posted May 4, 2007 (edited) $treeview is your treeview object $Input is the item to search: noname01, etc. #include <GuiTreeView.au3> #include <Array.au3> $Items = _GUICtrlTreeViewGetCount ($treeview) ;Count how many items there are Dim $Count[$Items] ;Create a array with '$Items' elements For $i = $Items to 1 step -1 ;Repeats the two following lines '$Items' times $Text = _GUICtrlTreeViewGetText($treeview, $i) ;Recieve the text of item '$i' _ArrayInsert( $Count,$i,$Text) ;Insert the text: '$Text' in the array Next $Pos = _ArraySearch ($Count, $Input, 0, 0, 0, True) ;Search in the array for your search term ($Input) _GUICtrlTreeViewSetState($treeview, $Pos, $TVIS_SELECTED) ;Select the searched and founded item (you can change this in what you want) I didn't tested it, but you should know now a little bit, how to go on. Edited May 5, 2007 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. 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