dubd83 Posted May 30, 2017 Share Posted May 30, 2017 I am working on automating an application and need to be able to click on an item in a treeview. I can successfully select the item if I match the text perfectly but the problem is the text changes during each launch of the application. The end of the text takes on a date and state so the tail end of the control is always different. I am trying to figure out how to insert a wildcard so I can click on the treeview item regardless of what the date is. The following code clicks on what I need but doesn't have a wildcard in it so it only works once. $treeView_hnd = ControlGetHandle($title, "", $window) $findItem = _GUICtrlTreeView_FindItem($treeView_hnd, "Scapa Test Trace - FullTest 20170530-090754") _GUICtrlTreeView_ClickItem($treeView_hnd, $findItem) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 30, 2017 Moderators Share Posted May 30, 2017 (edited) I believe if you set the third parameter, $bInStr, you could search for your partial string. Edited May 30, 2017 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
dubd83 Posted June 5, 2017 Author Share Posted June 5, 2017 (edited) Thanks for your response, I tried the following but still no luck. $treeView_hnd = ControlGetHandle($title, "", $window) $findItem = _GUICtrlTreeView_FindItem($treeView_hnd, "Scapa Test Trace - FullTest 20170605-11403", $bInStr = True) _GUICtrlTreeView_ClickItem($treeView_hnd, $findItem) Update, I failed to realize that the variable didn't need to be in the actual code. The following code worked. $treeView_hnd = ControlGetHandle($title, "", $window) $findItem = _GUICtrlTreeView_FindItem($treeView_hnd, "Scapa Test Trace - FullTest", True) _GUICtrlTreeView_ClickItem($treeView_hnd, $findItem) Edited June 5, 2017 by dubd83 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