automation - 如何使用 Autohotkey 创建三键组合热键?

标签 automation autohotkey

我需要使用 Ctrl + 9 + 8Ctrl + A 这样的热键 + B

Autohotkey 文档 here表示不支持三个或更多键的组合。但是,支持 Alt + Ctrl + Shift + X 修饰键组合,其中 X 可以是字母数字字符。

最佳答案

KeyWait ing 显示在另一个答案中,我想显示另一个选项,它使用 #IfGetKeyState() .
您可以通过使用 #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

我是否推荐这种方法是另一回事。
如果您的脚本只是简单的热键或类似的东西,这是一个很好的方法。
但是,如果您的脚本比这更复杂,您可能会遇到 #If 可能导致的问题。更多关于 documentation 的信息.
基本上,只需尝试一下,如果遇到问题,也许可以考虑另一种方法。

关于automation - 如何使用 Autohotkey 创建三键组合热键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62614287/

相关文章:

Jquery:如何自动将 window.location.hash 应用为与按钮 id 中相同的数字?

java - 如何使用 Katalon 将图像滑出屏幕

java - 如何使用 sikuli 向下滚动

autohotkey - 如何在一个 block 中检查多个变量的类型?

vim - Autohotkey 和 Vim 兼容吗?

amazon-web-services - 如何在创建新 EC2 实例时创建自动 Cloudwatch 警报

testing - 使用 Jenkins 进行负载测试

scala - 使用 Scala 发送击键和鼠标点击

windows - Autohotkey 中的多个光标

autohotkey - 自动热键上的科乐美代码