【发布时间】:2016-08-15 00:31:32
【问题描述】:
目的:在电子表格中执行公式时,我希望能够在不离开键盘的情况下添加括号。
如何使用 AutoHotKey 重新映射 NumLock 以执行以下操作:
- 单击 = 更改 NumLock 状态(如果为 ON,则为 OFF。如果为 OFF,则为 ON。)
- 双击后跟 NumpadDiv = 左括号
- 双击后按 NumpadMult = 右括号
- 双击,然后什么都没有 = 没有任何变化(超时)
我的代码:
~NumLock::
if (A_PriorHotkey <> "~NumLock" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
send {numlock}
return
}
SetTimer, WatchKeys, 200
return
WatchKeys:
if GetKeyState("NumpadDiv")
SendInput, {(}
else if GetKeyState("NumpadMult")
SendInput, {)}
else
SetTimer, WatchKeys, off
SetNumlockState, on
return
【问题讨论】:
标签: autohotkey