Sign in to follow this  
Followers 0
TomH

How to use variables in ControlClick() controlID descriptors

3 posts in this topic

Hi All,

Are we able to parameterize the controlID component for the ControlClick() command? For example, I want to use a variable name for the INSTANCE of a controlID:

CODE
ControlClick("myWindow","","[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE:$instanceVar]")

However, when I try this I get a return value of "0"(Failure) and the control does not get clicked. I know I can do this:

CODE
$controlIDVar = "[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE:" & $instanceVar & "]"

ControlClick("myWindow","",$controlIDVar)

but I prefer the style of the first example where the INSTANCE variable is placed directly into the controlID component of the ControlClick() command. Is this doable?

Thanks,

Tom

Share this post


Link to post
Share on other sites



no that style is just reading it

here are two styles that you can use

$controlIDVar = "[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE:" & $instanceVar & "]"

ControlClick("myWindow","",$controlIDVar)

and

ControlClick("myWindow","", "[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE:" & $instanceVar & "]")

The second one is faster then first declaring controlIDVar then using it


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Thanks for your suggestion, TerarinK.

ControlClick("myWindow","", "[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE:" & $instanceVar & "]")

would be faster than first defining the $controlID variable, then using it, and I'll adopt that method unless someone else knows of a way to allow variable expansion within the controlID parameter quotes, such that something of the form:

ControlClick("myWindow","", "[CLASS:WindowsForms10.BUTTON.app.0.202c666; INSTANCE: $instanceVar]")

would work.

Thanks again.

Tom

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  
Followers 0