Sign in to follow this  
Followers 0
gertsolo

Checking checkbox

8 posts in this topic

Hey,

I've written something quickly to test if a checkbox is checked or not.

What does not compute here?

#Include <GuiCombo.au3>

#Include <GuiTab.au3>

#include <GUIConstants.au3>

$title="Options"

WinActivate("Windows Media Player")

Send("!t")

Send("o")

$tabHwnd = ControlGetHandle ( $title, "", "[CLASS:SysTabControl32; INSTANCE:1]" )

If @ERROR THEN MsgBox(0,"","ERROR")

_GUICtrlTabSetCurFocus ( $tabHwnd, 5)

_GUICtrlTabSetCurSel ( $tabHwnd, 5)

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{TAB}")

$result = GUICtrlRead("1113",$GUI_CHECKED)

ConsoleWrite($result)


The more you learn, the less you know.

Share this post


Link to post
Share on other sites



Hey,

I've written something quickly to test if a checkbox is checked or not.

What does not compute here?

#Include <GuiCombo.au3>

#Include <GuiTab.au3>

#include <GUIConstants.au3>

$title="Options"

WinActivate("Windows Media Player")

Send("!t")

Send("o")

$tabHwnd = ControlGetHandle ( $title, "", "[CLASS:SysTabControl32; INSTANCE:1]" )

If @ERROR THEN MsgBox(0,"","ERROR")

_GUICtrlTabSetCurFocus ( $tabHwnd, 5)

_GUICtrlTabSetCurSel ( $tabHwnd, 5)

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{DOWN}")

send("{TAB}")

$result = GUICtrlRead("1113",$GUI_CHECKED)

ConsoleWrite($result)

GUICtrlRead will not work on external controls

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Search the help for IsChecked, I think that may help you in this situation :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm using the IsCheck command but have problems accessing the check box.

I have attached two pictures:

one with the WMP application and the checkbox I want to check

one with the windowInfo when I focus on that checkbox.

What should I use to focus on that checkbox?

This is what I have so far :

$result = ControlCommand ( "Options", "", 1113, "IsChecked" )

post-27256-1190972860_thumb.jpg

post-27256-1190972869_thumb.jpg

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites

I'm using the IsCheck command but have problems accessing the check box.

I've just had some luck with my tests. (I'm trying to do almost exactly the same thing).

I used this -- $result = ControlCommand ("My application Name", "Check box text", 1019, "IsChecked", "")

So, I think you need something like;

$result = ControlCommand ("Options", "DFX Audio Enhancement", 1113, "IsChecked", "")

Good luck.


Phil Seakins

Share this post


Link to post
Share on other sites

$result = ControlCommand ("Options", "DFX Audio Enhancement", 1113, "IsChecked", "")

That won't work because it's a SysListView32 control, although it conveniently only has one check box, it could have more. This might get it:

#Include <GuiListView.au3>

; Do stuff...

$hSLV = ControlGetHandle("Options", "DFX Audio Enhancement", "SysListView322")
$iChkState = _GUICtrlListViewGetCheckedState($hSLV, 0)
If $iChkState <> $LV_ERR Then
    MsgBox(64, "Status", "Checked status = " & $iChkState)
Else
    MsgBox(16, "Error", "Error accessing SysListView control.")
EndIf

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

mmm nice,

works like a charm, thx

By the way, just out of curiousity,

what's the exact command for checking it

I now have

ControlCommand ( "Options", "DFX Audio Enhancement","SysListView322","Check" )

PS is there life on mars?

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites

mmm nice,

works like a charm, thx

You're welcome.

By the way, just out of curiousity, what's the exact command for checking it

I now have

ControlCommand ( "Options", "DFX Audio Enhancement","SysListView322","Check" )

You're not reading your help file... _GUICtrlListViewSetCheckState()

PS is there life on mars?

A rover mechanic has got to go where the work is... :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0