Sign in to follow this  
Followers 0
Prasanna

IsChecked in the Control Command

5 posts in this topic

Hi guys,

I'm new to autoit. I've tried to trace a checkbox state using the "IsChecked" option but it results as unchecked even if the check box is in checked state. the code what i'm using is,

if(ControlCommand("Main","Main","[ClassNN:WindowsForms10.BUTTON.app332]","IsChecked", "")==0) Then

MsgBox(0,"","Not Checked")

Else

MsgBox(0,"","Checked")

EndIf

So anybody can help me with this. Thanks in advance.

Share this post


Link to post
Share on other sites



The comparation operator in a if condition is = not == like in c++ , php .. etc ..

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Prasanna,

Welcome to the forum!

The help file says

Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!

This code works as expected for me:

Run("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1")

WinWaitActive("Display Properties", "Screen Saver")

If ControlCommand("Display", "", "Button4", "IsChecked", "") = 0 Then
    MsgBox(0, "", "not checked")
Else
    MsgBox(0, "", "checked")
EndIf

The help file also says that you can use "==" as an operator in a If/Then/Else/EndIf line:

RemarksIf statements may be nested.

The expression can contain the boolean operators of AND, OR, and NOT as well as the logical operators <, <=, >, >=, =, ==, and <> grouped with parentheses as needed.

...but, you may not want to do that in this type of comparison...

The "IsChecked" ControlCommand returns a number.

I think that the "==" is for string compares, but you can figure out how AutoIt handles "=" and "==" in this thread - maybe:

http://www.autoitscript.com/forum/index.ph...showtopic=47388

As for this part of your code

"[ClassNN:WindowsForms10.BUTTON.app332]"

Please open the AutoIt Window Info tool

Click on the control of interest

Press Ctrl-Alt-F to freeze the data in the AutoIt Window Info tool

then copy/paste/post the info from the "Summary tab" of that tool for the Control Section - like this:

>>>> Control <<<<

Class: SysListView32

Instance: 1

ClassnameNN: SysListView321

-MSP-

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Hi, I have the same problem.

When I tested my script on a windows built-in application it worked however...

guess this goes under:

"AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation."

:)

Share this post


Link to post
Share on other sites

Hi, I have the same problem.

When I tested my script on a windows built-in application it worked however...

guess this goes under:

"AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation."

:)

Thanks For the Response,

I've written my dll call function in autoit for checkbox and combo boxes its wotking fine right now.

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