Jeremy Campbell
asked on
How can I get the current state of a checkbox on a window using Autoit script?
I am trying to set the value of a checkbox to be checked but I have not been able to figure out how to determine its current state using AutoIT. Any idea how I can pull this off?
Here is the data from the control:
>>>> Window <<<<
Title: End Labor Activity
Class: WindowsForms10.Window.8.ap p.0.2004ee e
Position: 78, 16
Size: 758, 694
Style: 0x16CF0000
ExStyle: 0x00050100
Handle: 0x0000000001865096
>>>> Control <<<<
Class: WindowsForms10.Window.8.ap p.0.2004ee e
Instance: 40
ClassnameNN: WindowsForms10.Window.8.ap p.0.2004ee e40
Name: chkComplete
Advanced (Class): [NAME:chkComplete]
ID: 8267440
Text:
Position: 167, 279
Size: 16, 17
ControlClick Coords: 4, 13
Style: 0x56010000
ExStyle: 0x00000000
Handle: 0x00000000007E26B0
Here is the data from the control:
>>>> Window <<<<
Title: End Labor Activity
Class: WindowsForms10.Window.8.ap
Position: 78, 16
Size: 758, 694
Style: 0x16CF0000
ExStyle: 0x00050100
Handle: 0x0000000001865096
>>>> Control <<<<
Class: WindowsForms10.Window.8.ap
Instance: 40
ClassnameNN: WindowsForms10.Window.8.ap
Name: chkComplete
Advanced (Class): [NAME:chkComplete]
ID: 8267440
Text:
Position: 167, 279
Size: 16, 17
ControlClick Coords: 4, 13
Style: 0x56010000
ExStyle: 0x00000000
Handle: 0x00000000007E26B0
ASKER
Thanks for that Bill, I will have a look into it and report back.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
KeyText supports a function called "If Pixel Color", which allows you to pick up the color of a specific pixel on the screen (relative to the screen, or relative to the dialog box it is running over) and make a decision based on that. To ensure that a checkbox is checked, you would do an IfPixelColor call and if it matches the blank background color, you could then issue the mouse click to toggle it.
A quick web search shows that AutoIt has a function called PixelGetColor, so this should be easily doable there, too.