hotkeys does not work when send is in loop

北城余情 提交于 2019-12-08 21:09:26

It's because your loop is blocking any other execution. Unless that loop is the only thing in your script, you generally want to avoid using loops and use timers instead.

Timers don't block further execution but act more like their own thread. Here's an example using a timer:

slashTimerActive := 0

m::
    if (!slashTimerActive)
        SetTimer, SendSlash, 100 ; Call the sub every 100ms
    else
        SetTimer, SendSlash, Off

    slashTimerActive := !slashTimerActive ; Flip the variable
return

; Subroutine
SendSlash:
    SendInput, /
return
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!