dubd83

Control Click Item using a wildcard

3 posts in this topic

#1 ·  Posted

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)

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I believe if you set the third parameter, $bInStr, you could search for your partial string.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by dubd83

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now