FrankV Posted July 17, 2009 Share Posted July 17, 2009 I use the function ControlClick with the controlID = TEXT. To simplify my script I want to replace the TEXT with a variable but the script returns 0 Failure. Example: $pos = 5 Dim $ButtonArray[6] = ["Graph", "Channel", "Summary", "Results", "Ref", "Info"] $MyButton = $ButtonArray[$pos];select the 6th element of the array. MsgBox(4096, "Array Value", $MyButton, 10); debugging Sleep (2000) $ButtonResult = ControlClick("MyApplication", "", "[CLASS:WindowsForms10.window.8.app.0.33c0d9d; TEXT:$MyButton]"); suppose to click on Info button. MsgBox(4096, "CtrlClick Return Value", $ButtonResult, 10);debugging Note: when I replace the variable with the actual text, it works. Is it a newbie syntax problem??? Thanks for your help! Link to comment Share on other sites More sharing options...
Authenticity Posted July 17, 2009 Share Posted July 17, 2009 ; Example 1 Opt("ExpandVarStrings", 1) $pos = 5 Dim $ButtonArray[6] = ["Graph", "Channel", "Summary", "Results", "Ref", "Info"] $MyButton = $ButtonArray[$pos];select the 6th element of the array. MsgBox(4096, "Array Value", $MyButton, 10); debugging Sleep (2000) $ButtonResult = ControlClick("MyApplication", "", "[CLASS:WindowsForms10.window.8.app.0.33c0d9d; TEXT:$MyButton$]"); suppose to click on Info button. MsgBox(4096, "CtrlClick Return Value", $ButtonResult, 10);debugging ; Example 2 $pos = 5 Dim $ButtonArray[6] = ["Graph", "Channel", "Summary", "Results", "Ref", "Info"] $MyButton = $ButtonArray[$pos];select the 6th element of the array. MsgBox(4096, "Array Value", $MyButton, 10); debugging Sleep (2000) $ButtonResult = ControlClick("MyApplication", "", "[CLASS:WindowsForms10.window.8.app.0.33c0d9d; TEXT:" & $MyButton & "]"); suppose to click on Info button. MsgBox(4096, "CtrlClick Return Value", $ButtonResult, 10);debugging Link to comment Share on other sites More sharing options...
FrankV Posted July 18, 2009 Author Share Posted July 18, 2009 Thanks Authentity! My script will be much more efficient. 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