Jump to content

Recommended Posts

Posted

I am creating a dummy program for testing.  It represents a "real" program that I can not install on my development system. The real program has a button having a specific ClassnameNN=btnConnect.

I an looking for a way to give that ClassnameNN to the button in my dummy program.  My searching has not found anything yet.  Can anyone point me to a doc or an example, or give me a solution?

TIA.

 

  • Solution
Posted

In your code, create a constant at the top containing the classname. Then throughout the code, use that constant rather than the literal classname.

When you're running on your development system, your dummy program's button would have the classname of 'Button', so that's what your constant would be set to when you're testing on the dummy program. Then when you're ready to use it on the real program, change the constant to 'btnConnect'.

; Uncomment the constant for the usage scenario needed
Global Const $sClassName = 'Button' ; classname for use in dummy program
; Global Const $sClassName = 'btnConnect' ; classname for use in actual program

; Assuming your target control is the first instance of the classname (i.e. Button1 or btnConnect1):
ControlClick("My Window", "", "[CLASS:" & $sClassName & "; INSTANCE:1]")

 

Posted

Thanks for the replies.  I was hoping to make the button names the same in both environments but I guess it's to much of a hassle, if even possible.  I'll use the accepted soution.  Thanks again.

 

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
  • Recently Browsing   0 members

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