【发布时间】:2014-10-12 17:46:52
【问题描述】:
我想设置一个 AutoHotkey 系统,使用尽可能少的键来访问许多(例如 100 个)组合键
对于初学者: Here is one good example of how to do the more basic command。 Another good method is mentioned here,我希望将两者结合起来并扩展成一个更全面的系统。
为了澄清这个问题:例如,我有 3 个键:a、b 和 c。仅从这 3 个键中获得最大使用量的好方法是什么?
为简单起见,这里有 3 个示例,说明仅使用我想到的 3 个键的方法:
- 按住所有 3 1 秒并释放 = "MsgBox 您按下 A、B、C 1 秒并释放"
- 同时点击全部 3 次 = "MsgBox 你点击了 A,B,C 两次"
- 按住所有 3 3 秒并释放 = " MsgBox 你按下 A、B、C 3 秒并释放"
第二部分是如何对 AutoHotkey 进行编程以在以后添加第四个键等时避免发生冲突的风险。
我之前尝试过的一种方法是使用 keystate ,并且在大多数情况下使用双击时应该是直截了当的。这是我正在使用它的工作:
CapsLock & a:: ; a hotkey to send a message when you click a two times while
; holding down CapsLock, left Shift, and left Control
GetKeyState, stateLCtrl, LCtrl
GetKeyState, stateLShift, LShift
if stateLCtrl=D
if stateLShift=D
if (A_PriorHotkey <> "CapsLock & a" or A_TimeSincePriorHotkey > 500)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, Esc
return ; does nothing on single click
}
MsgBox you clicked a two times while holding down
CapsLock, left Shift, and left Control ;output of hotkey
return
else
Return
else
return
return
这只是一个例子,我能想到的方法有很多。我认为这种方法不好有几个原因,所以如果有人有一个可以轻松扩展的更好的系统,那就太好了!
【问题讨论】:
标签: keyboard-shortcuts autohotkey hotkeys