简体   繁体   English

AHK:通过重复键序列实现不同的热键

[英]AHK: Different hotkeys via sequences with repeating keys

Ok my code has the following which works: 好的,我的代码具有以下作用:

^m::Send M text{enter}
    Return

^s::Send S text{enter}
    Return

^t::Send T text{enter}
    Return

Now I want to be able to add something like the following (this way it doesn't work): 现在,我希望能够添加类似以下内容的内容(这种方式不起作用):

^m & ^t:: Send M and T text{enter}
    Return

^m & ^s:: Send M and S text{enter}
    Return

^t & ^s:: Send T and S text{enter}
    Return

I want AHK to take all three sequences like Ctrl + S does one thing and Ctrl + M does another but Ctrl + S + M does a different third action. 我希望AHK采取全部三个顺序,例如Ctrl + S做一件事,而Ctrl + M做另一件事,但Ctrl + S + M做另一件事。

There is a similar post to this here: AutoHotKey key SEQUENCE, not just single-key hotkey 这里有与此类似的帖子: AutoHotKey键SEQUENCE,而不仅仅是单键热键

If you don't find a fitting solution, you might want to try the workaround which I've been using. 如果找不到合适的解决方案,则可能要尝试使用我一直在使用的解决方法。

Note: the following does not include any hotkey triggers like ^m:: , the problem is being solved with the hotkey -command and fitting label names, which actually look like a hotkey trigger ( ^m: ) 注:以下包括任何热键触发像^m:: ,这个问题正在与解决热键 -command和配件的标签名称,这实际上看起来像一个热键触发( ^m:

hotkey, ^m, ^m, On
hotkey, ^t, ^m, On

return

^m_and_^t:  ; will also be called from ^t & ^m
Send M and T text{enter}
triggered = true
return

^m_and_^s:
Send M and S text{enter}
triggered = true
return

^t_and_^s:
Send T and S text {enter}
triggered = true
return

^m:
triggered = false
hotkey, ^t, ^m_and_^t, On
hotkey, ^s, ^m_and_^s, On
loop
{
    getkeystate, isDown, m, P
    if isDown = U
        break
}
hotkey, ^t, ^t, On
hotkey, ^s, ^m_and_^s, Off ; -> ^s will keep its natural function

if triggered = false
{
    Send M text{enter}
}
return

^t:
triggered = false
hotkey, ^s, ^t_and_^s, On
hotkey, ^m, ^m_and_^t, On
loop
{
    getkeystate, isDown, t, P
    if isDown = U
        break
}
hotkey, ^m, ^m, On
hotkey, ^s, ^m_and_^s, Off ; -> ^s will keep its natural function
if triggered = false
{
    Send T text{enter}
}
return

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM