【问题标题】:Mapping Capslock to Esc and Capslock & C to a function in Autohotkey将 Capslock 映射到 Esc 并将 Capslock & C 映射到 Autohotkey 中的函数
【发布时间】:2013-11-13 21:11:40
【问题描述】:

我想通过以下方式配置自动热键:

Capslock::Esc

Capslock & C::
Run, www.stackoverflow.com
return

所以如果我只是按Capslock,它就像我按Esc 一样。另一方面,如果我同时按下Capslockc,它会调用用www.stackoverflow.com 打开浏览器的函数。

目前,当我在脚本中有其他功能时,重新映射似乎中断了。当我现在按下大写锁定时,它会在短时间内切换它,因此仅此键实际上什么都不做。我没有收到我的Esc

另一方面,按下 capslocks + A 会激活 capslock 并产生一个真正的 A。

有没有简单的方法来解决这个问题?

【问题讨论】:

  • 我在底部又添加了一条快捷方式,效果很好(F10::MsgBox 试试看)。也许问题是你的其余代码造成了一些麻烦?
  • @cajmer:你确定你得到的是真正的 Esc 吗?我添加了更多关于代码在我的末端做什么的信息。不,我的脚本中没有任何额外的行。
  • 你说得对,我没有得到正确的 Esc。我更关注“其他功能”——我的错。无论如何,我已经提交了一个应该满足您需求的答案。

标签: autohotkey


【解决方案1】:

查看此代码:

inProcess = 0

Capslock::
    Gui, 93:+Owner ; prevent display of taskbar button
    Gui, 93:Show, y-99999 NA, Enable nav-hotkeys
    inProcess = 1
    KeyWait, Capslock ; wait until the Capslock button is released
    Gui, 93:Cancel
    if (inProcess == 1){
        Send, {Esc}
    }
Return

#IfWinExist, Enable nav-hotkeys
    *c::
    Run, www.stackoverflow.com
    inProcess = 0
    return
#IfWinExist, ; end context-sensitive block

我在这里修改了一个可用的答案:http://www.autohotkey.com/board/topic/56428-problem-rebinding-ctrl-to-capslock-using/

【讨论】:

  • 我通过添加 inProcess = 0 作为标志来防止 Esc 被发送来让它工作。感谢您的帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-24
  • 2012-06-10
  • 2015-08-13
  • 2016-11-28
  • 1970-01-01
  • 2016-02-21
  • 2020-05-16
相关资源
最近更新 更多