PapaOz Posted March 16, 2023 Share Posted March 16, 2023 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 More sharing options...
Solution TimRude Posted March 16, 2023 Solution Share Posted March 16, 2023 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 More sharing options...
argumentum Posted March 16, 2023 Share Posted March 16, 2023 (edited) 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 March 16, 2023 by argumentum =) Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
PapaOz Posted March 16, 2023 Author Share Posted March 16, 2023 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. argumentum 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now