【问题标题】:AHK: Different hotkeys via sequences with repeating keysAHK:通过带有重复键的序列的不同热键
【发布时间】:2013-07-31 02:09:34
【问题描述】:

好的,我的代码具有以下功能:

^m::Send M text{enter}
    Return

^s::Send S text{enter}
    Return

^t::Send T text{enter}
    Return

现在我希望能够添加如下内容(这样就行不通了):

^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

我希望 AHK 采用所有三个序列,例如 Ctrl+S 做一件事,而 Ctrl+M执行另一个操作,但 Ctrl+S+M 执行不同的第三个操作。

这里有一个类似的帖子:AutoHotKey key SEQUENCE, not just single-key hotkey

【问题讨论】:

  • 呃,我不明白。你的代码不适合你吗?它对你没有什么用?
  • 抱歉在解释中编辑了。
  • 这听起来对我来说真的很热门。您是否考虑过使用它们而不是热键?此外,我不建议使用CTRL + LETTER 热键,因为它们几乎总是会阻止许多程序中的某些快捷方式。例如。 ^s 是编辑器中的标准保存快捷方式; ^t 是浏览器中的新标签快捷方式,依此类推。
  • 是的,我已经将它切换为 alt,但我遇到了同样的情况,所以我不想编辑。阅读热门字符串。真的很酷的东西会使用它,因为它适用于我正在做的一件事。然而,这并不是我想要的。因为我希望它适用于任何操作,而不仅仅是文本。
  • “任何行动”是什么意思?热字串标签能够执行任何类型的代码。

标签: keyboard-shortcuts autohotkey


【解决方案1】:

如果您没有找到合适的解决方案,您可能想尝试我一直在使用的解决方法。

注意:以下包括任何热键触发器,如^m::,问题正在通过hotkey-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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    • 2018-10-10
    • 2017-11-29
    • 1970-01-01
    相关资源
    最近更新 更多