Jump to content

Help with Checkbox when ControlID isn't present


Recommended Posts

Hello.

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

Text:

Style: 0x50000003

ExStyle: 0x00000000

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

(1): Done

(2):

(3):

(4): Pop-ups were allowed.

(5):

(6):

(7):

(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)
    
    
;GUICtrlSetState("CLASSNN:Button1",$GUI_ENABLE)
        
;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?

Thanks!

Link to comment
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

Link to comment
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.

[/code]
$Checkbox1 = ControlCommand("Microsoft Internet Explorer", "", "Button1", "IsChecked", "")
[code]

Thanks so much for your time.

Edited by juliet1973
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...