Sign in to follow this  
Followers 0
happydood

Pulling out my hair, please help!

7 posts in this topic

#1 ·  Posted (edited)

It seems so simple, yet it is making me crazy!

I've been working on this silly thing for about 6 hours, and can't get it to work at all.

I just want to make a checkbox check when a certain action happens, and uncheck when a different action happens. I know the actions are working, because when I ask it to write text on action, it writes text, but I can't get it to CLICK the checkbox.

Here are the details:

First I tried this:

CODE
$action = GetAction();

if $action = 1 then

ControlCommand($tablename, "", 1311620, "Check", "");

EndIf

For reference: The number :1311620: is the Control ID for the button I am trying to check. The $TableName is the window that the box is in.

Is there another or better way to make a checkbox check then a control command, or do I just have it set up wrong?

Thanks For your help!!!

Edited by happydood

Share this post


Link to post
Share on other sites



search the help file for GUICtrlGetState and GUICtrlSetState

Share this post


Link to post
Share on other sites

search the help file for GUICtrlGetState and GUICtrlSetState

I did some reading, but it seems that the GUICtrlSetState only works for a checkbox that has been created with a GUOCtrlCreate Function.

I tried this:

GUICtrlSetState ( $SelectForOne, $GUI_CHECKED )

But it gave me the error that $GUI_CHECKED was undeclaired.

Share this post


Link to post
Share on other sites

Well its anyones guess, No sure how you'll set the state of a checkbox to checked without creating a Gui or a checkbox.

Share this post


Link to post
Share on other sites

Well its anyones guess, No sure how you'll set the state of a checkbox to checked without creating a Gui or a checkbox.

The checkbox already exists in a windows program that is running, so I don't need to create it, simply click it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What Windows program? And is it XP?

If you can specify what program, maybe we can better help you with your question.

Here is a little example of what you can expect with the 'ControlCommand' function.

#include <GUIConstants.au3>

$s_Title = 'CheckBox Test'
$s_Ver = '1.0'

GUICreate($s_Title & ' v.' & $s_Ver, 300, 100, -1, -1)

$chkbox = GUICtrlCreateCheckbox('State', 10, 10)
    GuiCtrlSetState(-1, $GUI_DISABLE)
$check = GUICtrlCreateButton('Check State', 40, 60)
$change = GUICtrlCreateButton('Change State', 180, 60)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $check
            $x = ControlCommand($s_Title & ' v.' & $s_Ver, '', $chkbox, 'IsChecked', '')
            If $x = 1 Then
                MsgBox(0, $s_Title, 'The checkbox state is checked.')
            Else
                MsgBox(0, $s_Title, 'The Checkbox state is unchecked.')
            EndIf
        Case $change
            $x = ControlCommand($s_Title & ' v.' & $s_Ver, '', $chkbox, 'IsChecked', '')
            If $x = 1 Then
                ControlCommand($s_Title & ' v.' & $s_Ver, '', $chkbox, 'UnCheck', '')
            Else
                ControlCommand($s_Title & ' v.' & $s_Ver, '', $chkbox, 'Check', '')
            EndIf

    EndSwitch
WEnd
Exit

Edit:

Expanded my question and added code.

Edited by terrabyte

"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor"Mess with the best, die like the rest!!" -Hackers"This above all to thine own self be true." -William Shakespeare"Corruption is only as corrupted as the individual makes it out to be." -Mozart_ONLINECheck out this free 1 GB FTP website at DriveHQ.com. You can control the users and even publish a website for free!![s]Your-Start.com - A online website that you can customize to hold all you links, news information, and other website info.[/s]

Share this post


Link to post
Share on other sites

my bad

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