Jump to content

Recommended Posts

Posted

Hi,

  I'm trying to get the status of checkbox(whether it is checked or not). I tried using ControlCommand,
 

If ControlCommand($winHandle, "Accounts", "3278388", "IsChecked", "[NAME:Accounts]") = 0 Then
MsgBox(0, "", "not checked")

  But it's not working for me. Control informations are:

Class                   :  WindowsForms10.BUTTON.app.0.31d2b0c_r75_ad2
Instance              :  7
ClassnameNN     :  WindowsForms10.BUTTON.app.0.31d2b0c_r75_ad27
Name                  :  Accounts
Advanced Mode :  [NAME:Accounts]
ID                       : 3278388
Text                   :  Accounts
Position             :  15, 112
Size                   :   83, 19
ControlClick Coords  :  46, 14
Handle             :  0x00320634

And I displayed the status of the checkbox but it always shows 0(even it is already checked). so the message box always shows "not checked". 
Could you please help me to find a solution for this problem?

 
Posted

Your ControlCommand for IsChecked is called incorrectly.  The option parameter is an empty string with this command.  Also, if you are using the window handle, then you do not need the "text" parameter.  Try this.

If ControlCommand($winHandle, "", 3278388, "IsChecked", "") = 0 Then MsgBox(0, "", "not checked")

Adam

Posted

This can be done with the UI Automation framework.

Download the two UDFs in bottom of first post, and download and run the code in the "Simple spy demo" codebox in the middle of first post.

To verify that a control can be identified place the mouse cursor over the control and press Ctrl+w. You can see an example here.

Note that the framework is based on COM interface objects (created with ObjCreateInterface), so it's not just as easy to use as most built-in commands.

Posted (edited)

Thank you all for your responses.

The problem solved using; ControlClick($winHandle, "", "[NAME:Accounts]") and checking the return value. :)

Edited by Geethu

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
×
×
  • Create New...