Mar*_*tin 2 automation autohotkey
我需要使用像Ctrl+ 9+8或 Ctrl+ A+ 这样的热键B。
Autohotkey 文档此处表示不支持三个或更多键的组合。但是,支持Alt+ Ctrl+ Shift+X修饰键组合,其中 X 可以是字母数字字符。
KeyWaiting 在另一个答案中显示,我想展示另一个选项,即使用#Ifand GetKeyState()。
您可以通过使用指令设置任何条件来创建上下文相关的热键#If。
在您的情况下,您需要检查热键的第一个键是否被按住。
然后您将最后一个键设置为热键。
#If, GetKeyState("Ctrl") ;start of context sensitive hotkeys
8 & 9::
MsgBox, % "Ctrl + 8 + 9 held down"
return
#If ;end of context sensitive hotkeys
;example of holding down even more keys
;is only going to work if your system can
;recognize this many keys at once
#If, GetKeyState("Ctrl") && GetKeyState("1") && GetKeyState("2") && GetKeyState("3") && GetKeyState("4") && GetKeyState("5")
6 & 7::
MsgBox, % "Ctrl + 1 + 2 + 3 + 4 + 5 + 6 + 7 held down"
return
#If
Run Code Online (Sandbox Code Playgroud)
我是否推荐这种方法是另一回事。
如果您的脚本只是简单的热键或类似的内容,那么这是一个非常好的方法。
但如果您的脚本比这更复杂,您可能会遇到#If可能导致的问题。有关更多信息,请参阅文档。
基本上,只要尝试一下,如果遇到问题,也许可以考虑另一种方法。
| 归档时间: |
|
| 查看次数: |
11186 次 |
| 最近记录: |