happydood Posted March 2, 2007 Share Posted March 2, 2007 (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 March 2, 2007 by happydood Link to comment Share on other sites More sharing options...
Will66 Posted March 2, 2007 Share Posted March 2, 2007 search the help file for GUICtrlGetState and GUICtrlSetState Link to comment Share on other sites More sharing options...
happydood Posted March 2, 2007 Author Share Posted March 2, 2007 search the help file for GUICtrlGetState and GUICtrlSetStateI 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. Link to comment Share on other sites More sharing options...
Will66 Posted March 2, 2007 Share Posted March 2, 2007 Well its anyones guess, No sure how you'll set the state of a checkbox to checked without creating a Gui or a checkbox. Link to comment Share on other sites More sharing options...
happydood Posted March 2, 2007 Author Share Posted March 2, 2007 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. Link to comment Share on other sites More sharing options...
i386 Posted March 2, 2007 Share Posted March 2, 2007 (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 March 2, 2007 by terrabyte Spoiler "...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." -i386 Link to comment Share on other sites More sharing options...
Will66 Posted March 2, 2007 Share Posted March 2, 2007 my bad Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now