Sign in to follow this  
Followers 0
PCrosthwaite

Find control based on its text

2 posts in this topic

Hi, I have a really stupid app that I'm trying to automate some functions in. Basically, i have a bunch of edit controls which i need to double click on. The problem is that the controls ClassNN etc. keep changing each time the window is opened. The only thing that stays the same is the text displayed in the edit control.

So far i have 

; Get the Window Handle of my app

Local hWnd = WinGetHandle("My Crappy App", "")

; Get the control based on the ClassNN

$hControl = ControlGetHandle($hWnd, "", "Edit16")

; Get the controls position
$aPOS = ControlGetPos("", "", $hControl)

; Doubleclick on the control. Because of the way that the window is displayed, ControlGetPos doesn't seem to be able to return the true location, so add some pixels to get to the right spot
Mouseclick("left",$aPOS[0]+200,$aPOS[1]+205,2)

How can I get the control (so i can use ControlGetPos) if I don't have the ClassNN? Is there a way that I can find it based on the text in the edit control? eg. "SomeText"

I've tried to use ControlClick, but this doesn't actually click on the edit control, which is why I'm having to use MouseClick.

 

Any help would be awesome :)

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
Sign in to follow this  
Followers 0