【问题标题】:AutoHotkey - How to map a combination with AltGr to send a combination Ctrl+key to a specific Application?AutoHotkey - 如何使用 AltGr 映射组合以将组合 Ctrl+键发送到特定应用程序?
【发布时间】:2020-08-09 10:04:12
【问题描述】:

我正在尝试执行以下操作: 无论应用程序当前处于活动状态,使用 AltGr+N 键将组合 Ctrl+N(下一曲目)发送到 MusicBee。

我尝试了以下方法:

<^>!N::
if WinExist("ahk_exe MusicBee.exe")
    ControlSend, ahk_parent, ^n ; Send the keys to the last found window (found by WinExist)

这应该可以工作。这个想法是能够通过按住 AltGr 并多次按 N 来循环下一个轨道。表示我不想释放 AltGr 键以将指令发送到 MusicBee。

问题如下: 按住 AltGr 时,第一次按 N 时,什么都不会发生(我通过快捷方式(如果我添加一个 MfgBox,我看到我通过代码,但没有任何反应。当我第二次按 N 时,它会起作用。当我第一次说什么都没有发生时,这并不准确:这会将我的左控制键锁定为向下状态。 因此,例如,如果我在记事本中,我按 AltGr+N(MusicBee 中没有任何反应),但如果我只按“O”,则显示打开文件的面板(就像按下 Ctrl+O 一样)。

那我也试过了:

ControlSend, ahk_parent, ^n{LCtrl up}

ControlSend, ahk_parent, {LCtrl down}n{LCtrl up}

但没有成功。

我也玩过:

KeyWait N        ; wait the N key to be released

SetKeyDelay 10,10

但没有更多的成功。

你知道如何避免第一个组合得到 AltGr 会导致阻塞 LCtrl 吗?

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    您使用的是哪个版本的 AutoHotkey?据开发商介绍—— 请在此处查看 AutoHotkey 论坛上此主题的最后一篇文章 https://www.autohotkey.com/boards/viewtopic.php?f=14&t=6006 - “一些与 AltGr 相关的错误已得到修复……”[1]

    因此,如果您不使用 v1.1.33.02,请尝试更新到最新版本 - 当前是 v1.1.33.02 - https://www.autohotkey.com/download/ - 或者您可以使用 AutoHotkey 文件夹中的“安装程序”脚本更新为好吧 - 它可能会解决您的问题。

    [1] 在此 https://www.autohotkey.com/docs/AHKL_ChangeLog.htm 页面上查找 AltGr 以获取概览。

    【讨论】:

    • 感谢您的回答。这是正确的解释。我的 AutoHotkey 版本是 1.1.30。更新到 1.1.33.02 解决了 AltGr 的问题。使用模式: !N:: if WinExist("ahk_exe MusicBee.exe") ControlSend, ahk_parent, ^n Return ;现在工作正常,没有问题保持左控件处于活动状态。
    猜你喜欢
    • 1970-01-01
    • 2020-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-09
    • 2020-11-13
    • 2016-06-26
    • 1970-01-01
    相关资源
    最近更新 更多