Jump to content

Custom ClassnameNN


Go to solution Solved by TimRude,

Recommended Posts

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.

 

Link to comment
Share on other sites

  • Solution

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]")

 

Link to comment
Share on other sites

Just make your dummy program and have the Classname a variable:

Global $class_bttnConnect = "Button1" ; "bttnConnect"

that way you don't have to make thing more difficult than needed.

PS: @TimRude beat me to the post :) 

Edited by argumentum
=)

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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...