[英]AutoHotKey key SEQUENCE, not just single-key hotkey
I'm not stupid... really. 我不傻...真的。 How do you map a key SEQUENCE (ie: Ctrl + Q , F ) in AutoHotKey.
如何在AutoHotKey中映射键SEQUENCE(即Ctrl + Q , F )。
I've got Ctrl + Q down: 我已经按下Ctrl + Q :
^q::
I've even got F : 我什至有F :
f::
The examples in the help files even show how to do two keystrokes in a row: 帮助文件中的示例甚至显示了如何连续两次击键:
Numpad0 & Numpad1::
But it just will not work with: 但这不适用于:
^q & f ::
Or any of these either: 或以下任何一个:
LCtrl & q & f::
^q & ^f::
^q^f::
^qf::
How do I accomplish a Key SEQUENCE triggering something, when one of those keys is the Ctrl key? 当这些键之一是Ctrl键时,如何完成触发某些操作的Key SEQUENCE? I looked into using a HOTSTRING instead, but couldn't work out how to include the Ctrl character, in that context!
我考虑使用HOTSTRING来代替,但是在这种情况下却无法确定如何包含Ctrl字符!
Alright; 好的; The answer seems to be:
答案似乎是:
^q::
Input Key, L1
if Key=f
...some code here...
return
In case someone's looking for a similar thing, but actually want Ctrl Q + Ctrl F and only if Ctrl is held throughout (so, to some, this might seem like Ctrl Q + F ), then here's how to do that: 如果有人正在寻找类似的东西,但实际上想要Ctrl Q + Ctrl F,并且仅在整个过程中都按住Ctrl (因此,对于某些人来说,这似乎像Ctrl Q + F ),那么这是这样做的方法:
$Ctrl::Send {Ctrl Down}
$Ctrl UP::
ChordIsBroken := True
Send {Ctrl Up}
Return
^q::
ChordIsBroken := False
Input, OutputVar, L1 M
If (!ChordIsBroken && Asc(OutputVar) = 6)
{
MsgBox "Hello, World!"
}
Else
{
SendInput %OutputVar%
}
Return
See https://superuser.com/a/725303/145431 for my explanation. 请参阅https://superuser.com/a/725303/145431了解我的说明。
Or you can do it like this: 或者您可以这样做:
q & f::
if GetKeyState("Control") {
; Do something
return
}
return
I think this is a bit more readable than using Input Key, L1 as in above. 我认为这比使用输入键L1更具可读性。
This catches CTRL + F . 这捕获了CTRL + F。 If Q is held down at that moment, your code fires.
如果此时按下Q,则代码将触发。
^f::
If GetKeyState("q", "p") {
MsgBox test
} Else {
Send ^f
}
return
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.