TomH Posted August 18, 2008 Share Posted August 18, 2008 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: CODEControlClick("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 Link to comment Share on other sites More sharing options...
TerarinK Posted August 19, 2008 Share Posted August 19, 2008 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 Link to comment Share on other sites More sharing options...
TomH Posted August 19, 2008 Author Share Posted August 19, 2008 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 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