Jump to content
Sign in to follow this  

Help with Checkbox when ControlID isn't present

Recommended Posts


I've been trying to see the value of a checkbox and check it if it isn't already checked.

This is a screen for one of our applications here at work that we are trying to automate entering of data. The checkbox is already drawn for me and there is no ControlID listed in the Active Window Information. My window information says this:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Microsoft Internet Explorer

Class: IEFrame

Size: X: -4 Y: -4 W: 1032 H: 748

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Client: X: 543 Y: 255

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xFFFFFF Dec: 16777215

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 538 Y: 253 W: 12 H: 11

Control ID:

ClassNameNN: Button1


Style: 0x50000003

ExStyle: 0x00000000

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

(1): Done



(4): Pop-ups were allowed.




(8): Local intranet

I've tried several ways - including trying to use the classname. When I do try to use the classname, the value returned is always zero whether the checkbox is actually checked or not.

Here are some of the methods I've tried. Some of them are commented out after I realized it wasn't getting me what I needed. I also thought about trying to use the mouse position, but there isn't any guarantee that this checkbox will always be in the same spot. I also have repeating rows of checkboxes I need to check after the first one.

$handle = GuiCtrlRead ( "CLASSNN:Button1" , 0)
MsgBox (0, "Text Read Was:", $handle)
;If ControlCommand ( "Microsoft Internet Explorer", "", "[CLASSNN:Button1]", "IsChecked", "" ) Then ControlCommand ( "Microsoft Internet Explorer", "", "[CLASSNN:Button1]", "UnCheck", "" )
;$Button1 = ControlCommand ( "Microsoft Internet Explorer", "", "[CLASSNN:Button1]", "IsChecked", "" )

;If GUICtrlRead("[CLASSNN:Button1, 0]") = $GUI_CHECKED Then GUICtrlSetState("[CLASSNN:Button1, 0]", $GUI_UNCHECKED)
;MsgBox(0, "Text read was:", $Button1)

Can anyone help me with this? Am I looking totally in the wrong direction? Am I even close? Is there another method to get the value of a checkbox when the ControlID isn't present?


Share this post

Link to post
Share on other sites

ControlCommand("Microsoft Internet Explorer","","Button1","UnCheck")

If you always want it unchecked, you don't really need to test first whether or not it is checked.

If that's not working, is this a part of some webpage? If so, you might need to use something like _IEFormElementCheckboxSelect

Share this post

Link to post
Share on other sites

Thank you so much for the information. That unfortunately didn't work for me. I did need to verify if it was checked or not and then check it if it wasn't (along with verifying some other information first - so I wouldn't always have to check it).

However, I was able to subsitute the class for the control ID and get the value of the checkbox using the Control Command as you suggested.

$Checkbox1 = ControlCommand("Microsoft Internet Explorer", "", "Button1", "IsChecked", "")

Thanks so much for your time.

Edited by juliet1973

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...