Sign in to follow this  
Followers 0
Rabbitman

Checkbox

10 posts in this topic

So last thing I need to know is about the checkbox. I have successfully created a Gui with checkboxes and applied them to scripts and they work (yay) but the problem is;

I check a checkbox and the function works.

I uncheck it and it still goes as if the checkbox is checked when really it isn't.

I know there is a solution to this but I can't seem to find it.

Any help would be appreciated

Share this post


Link to post
Share on other sites



This is a guess based on the code you posted in this thread.

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $My_Checkbox
            If GUICtrlRead($Msg) = 1 Then
            ;;Do Something
    EndSwitch
WEnd

Of course you very seldom need to know if a checkbox is clicked. Usually you just have to read the checked state when you click a button or call a function by some other method.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for you reply! But I do not think you understand my question. Let's just say my program typed a paragraph in notepad while the checkbox is checked. So check it and it starts typing. Then halfway through I decide to stop typing so I uncheck it. I go back to notepad but it is continuing on as if I never unchecked it. I am not too sure if that is what you answered (I hope it is though) but that is a more clear example. Also I do not see where I would put in my checkbox. Another thing is that this has more than one checkbox.

Rabbitman

Edited by Rabbitman

Share this post


Link to post
Share on other sites

I based that on your posted code which was nothing.

Post w bit of what you have and what you want it to do when checked and when not checked and we shall see what we can come up with.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Ok so I am not at my computer atm so I can not give you my script, but I can give you an example:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $checkCN, $msg
    GUICreate("My GUI Checkbox") 

    $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)

    GUISetState()
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $checkCN Then 
Send("{This is an example. So if I am in notepad this will type but I am too lazy to type in the extra commands for it so I will not. What I want it to do for example is  type this when checkbox is checked and then stop when checkbox is not checked. Thanks GeoSoft.}")
   EndIf 
WEnd
EndFunc   ;==>Example

Share this post


Link to post
Share on other sites

Then best wait until you get the actual code because you can not interupt the send as you have it here. This might give you a general idea though

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $checkCN, $msg
    GUICreate("My GUI Checkbox") 

    $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)

    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Switch $msg
        Case $checkCN
                If GUICtrlRead($Msg) = 1 Then
                     Send("{This is an example. So if I am in notepad this will type but I am too lazy to type in the extra commands for it so I will not. What I want it to do for example is  type this when checkbox is checked and then stop when checkbox is not checked. Thanks GeoSoft.}")
                Else
                    ContinueLoop
                EndIf
        Case -3
            Exit
        EndSwitch
    WEnd
EndFunc   ;==>Example

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Oh really? So I can't have checkboxes for the send function? That's what all my things are... And what's the continue loop thing? Does that do anything related to checkboxes or...?

Share this post


Link to post
Share on other sites

This means I have to redo everything... or no GUI. Is there a way to put a send function into a different function that will work with checkboxes?? omg

Share this post


Link to post
Share on other sites

Ok I guess I will just use hotkeys then. Thank you for your help though

Share this post


Link to post
Share on other sites

Woah, slow down a bit here. We don't have the same time zones so I may not be replying as soon as you would like.

You can use the checkbox for your send function as I showed above. The trick is to define the conditional. In this case if you check the box it will send the string, if you uncheck the box it just continues the loop and doesn't send the string which takes care of your original question as I see it.

Read up on ContinueLoop in the help file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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