Jump to content
Sign in to follow this  

Case in Switch loops continuously

Recommended Posts


I made 2 radio buttons for my GUI: 1 to enable the key-swapping function, and the other to "try and disable" the function. This is my first time attempting to do something with radio buttons and as well as working with booleans. I don't know if this is the right way to exit the loop in Case $Radio1 so please suggest a better working way.

Case $Radio1 ;enable key swapping
    $input_oldkey = GUICtrlRead($oldkey) ;reads the input under Replace label
    $upper_oldkey = StringUpper($input_oldkey) ;converts to uppercase to be ready for hex conversion    
    MsgBox(0, "is it upper?", $upper_oldkey)
    $hex_oldkey = _StringToHex($upper_oldkey)   
    MsgBox(0, "is it hexed?", $hex_oldkey)
    $input_newkey = String(GUICtrlRead($newkey)) ;reads the input under New label, converts to string and passes.
        $dll = DllOpen("user32.dll")
        global $power_off = false

        Do;While 1
        If _IsPressed($hex_oldkey, $dll) Then 
            ;MsgBox(0,"_IsPressed", "A Key Pressed") Taking this off allows you to hold down the button and sends $input_newkey repeatedly.
            WinWaitActive("Ex - Notepad")
            Send("{" & $input_newkey & "}")
        Until $power_off = true;$power_off = true;WEnd

Case $Radio2 ;disables key swapping
$power_off = true

Share this post

Link to post
Share on other sites

GUICtrlCreateRadio example in the helpfile can help you to know which radio button is checked in a better way ! Posted Image

AutoIt X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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