0

I want to use breakout(var) instead of typing that if statement a million times. How do I make that work? Return returns from the function but I want to end the hotkey.

f::{
    send "a"
    sleep 1000

    if (A_PriorKey!="f" and A_PriorKey!=""){
      return ;does the desired behaviour, but I want to use breakout("f") instead of 3 liner if statments
    }
    ;breakout("f")

    send "a"
    sleep 1000
}


breakout(var){
    if (A_PriorKey!=var and A_PriorKey!=""){
        return
    }
}

If I press F, after 1000ms it checks if I pressed any other key since the hotkey began. If I did it ends the hotkey early.

1 Answer 1

1

Hotkeys are started in a new thread, which means you can use Exit to kill the thread, effectively achieving what you want.

breakout(var){
    if (A_PriorKey!=var and A_PriorKey!=""){ 
        Exit
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.