最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

return - How do I setup a function call to end a hotkey? - Stack Overflow

programmeradmin1浏览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.

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.

Share Improve this question edited Feb 13 at 0:34 user4157124 3,00214 gold badges31 silver badges46 bronze badges asked Jan 22 at 13:15 kitekite 3133 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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
    }
}
发布评论

评论列表(0)

  1. 暂无评论