Jump to content
Sign in to follow this  

Referencing control when the id & class always change

Recommended Posts


I'm having a hard time referencing a particular control because the ID and class change every time the app runs. The instance and text are the same but [iNSTANCE:2] doesn't appear to be specific enough and using TEXT with or without the instance isn't working. This particular control is a custom button control that has an icon and text. If I try to use ControlGetHandle with just the instance and/or text I just get an empty string.

I'm using AlwaysUp to run an application as a service and everything except for this one control works as expected. I can't activate any controls but I can focus on them (with a specific enough reference). I can't use most of the WIN* commands but the Control* commands are working for me.

If I could get the handle of the actual control used in the current execution then I could use that to resolve my issue.

Is there any way to loop through controls on a window in AutoIT?

One of the references to find a control is documented as "X \ Y \ W \ H - The position and size of a control". Could I get an example of what that looks like in use? Is the position relative to the window the control belongs to or the entire screen?

Any other ideas?

Thanks for any help!

Here's the summary if it helps to show what I have to work with. Remember that the class,ID, and handle change every time the window is opened.

>>>> Window <<<<
Title:  Series Auto Post
Class:  WindowsForms10.window.8.app.0.378734a
Position:   865, 397
Size:   300, 192
Style:  0x16CF0000
ExStyle:    0x00050100
Handle: 0x003A034E

>>>> Control <<<<
Class:  WindowsForms10.BUTTON.app.0.378734a
Instance:   2
ClassnameNN:    WindowsForms10.BUTTON.app.0.378734a2
Advanced (Class):   [CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]
ID: 4129582
Text:   &OK  
Position:   4, -1
Size:   72, 24
ControlClick Coords:    36, 9
Style:  0x5601000B
ExStyle:    0x00000000
Handle: 0x003F032E

>>>> Mouse <<<<
Position:   909, 428
Cursor ID:  2
Color:  0xC1BDB2

>>>> StatusBar <<<<

>>>> Visible Text <<<<
Minutes Between Runs:

>>>> Hidden Text <<<<

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