How to use hotkey,off in #IfWinActive section

こ雲淡風輕ζ 提交于 2019-12-23 05:36:09

问题


I am using the following code:

#IfWinActive ahk_class Notepad
4::Send,4
5::
    Hotkey,4,off
;~  do something
    Hotkey,4,on
    Return
#IfWinActive

but it generates this error:

Prompt Error:  Nonexistent hotkey variant (IfWin).

回答1:


I don't understand what you mean by using 4 to send 4 - it seems redundant.

I tried it like this. pushing 4 will send 6, and pushing 5 will send 4.

#IfWinActive ahk_class Notepad
{
    4::Send,6
    5::
        Hotkey,4,off
        send, 4
        Hotkey,4,on
    Return
}

The idea here is that the brackets encase the entire function within the IfWinActive. If notepad isn't active, nothing at all happens.



来源:https://stackoverflow.com/questions/17871390/how-to-use-hotkey-off-in-ifwinactive-section

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