Jump to content

Why do Instance numbers change on a control?


Recommended Posts

I have a script that is automating installation of printer drivers. I have seen where the instance number very same "OK" button changes depending on other things happening on the PC. What is going on? I have been using ControlClick($title,$text,"[CLASS:Button,Instance:3]","Primary") , but found that at times the script does not run properly because now the instance number is different. What should I be using to identify the control? Just the ID like [iD: 3]?

Link to comment
Share on other sites

I have a script that is automating installation of printer drivers. I have seen where the instance number very same "OK" button changes depending on other things happening on the PC. What is going on? I have been using ControlClick($title,$text,"[CLASS:Button,Instance:3]","Primary") , but found that at times the script does not run properly because now the instance number is different. What should I be using to identify the control? Just the ID like [iD: 3]?

You have to use whatever will remain consistent. What works varies by the GUI you are working with. Maybe the ControlID is consistent, maybe X/Y coordinates, maybe the control text (i.e. "&Next"), etc.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

When controls are created or destroyed at runtime, then there are more or less of them so enumerating controls (what the instance derivative is) returns different numbers. This is why we give several ways of identifying controls.

Lar.

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...