AutoHotkey - 仅在一个应用程序中捕获热键组合 - 不要阻止其他应用程序使用相同的组合
AutoHotkey - capture a hotkey combination in one application only - do not prevent other apps from using same combination
我创建了一个我只想在 MS Teams 中使用的热键(缺少 'Reply to message' 功能的解决方法)。
我将它分配给了 Ctrl+R,但是它似乎阻止了使用相同组合的其他应用程序注意到该热键。
代码如下:
^r::
if WinActive("ahk_exe Teams.exe")
{
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
}
return
有没有办法告诉 AHK 在活动应用不是团队时让组合键冒泡?
我尝试添加一个 'else' 子句,我会在其中 Send, ^r
但那没有用。
其实,我明白了。发布工作解决方案。
看来我需要将热键声明包装在 #ifwinactive 指令中。
#IfWinActive("ahk_exe Teams.exe")
^r::
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
return
#IfWinActive
@ThierryDalon 提供的更好、更全面的解决方案和更强大的方法 - https://github.com/tdalon/ahk/blob/master/Lib/Teams.ahk
https://tdalon.blogspot.com/2020/11/teams-shortcuts-smart-reply.html
我创建了一个我只想在 MS Teams 中使用的热键(缺少 'Reply to message' 功能的解决方法)。
我将它分配给了 Ctrl+R,但是它似乎阻止了使用相同组合的其他应用程序注意到该热键。
代码如下:
^r::
if WinActive("ahk_exe Teams.exe")
{
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
}
return
有没有办法告诉 AHK 在活动应用不是团队时让组合键冒泡?
我尝试添加一个 'else' 子句,我会在其中 Send, ^r
但那没有用。
其实,我明白了。发布工作解决方案。
看来我需要将热键声明包装在 #ifwinactive 指令中。
#IfWinActive("ahk_exe Teams.exe")
^r::
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
return
#IfWinActive
@ThierryDalon 提供的更好、更全面的解决方案和更强大的方法 - https://github.com/tdalon/ahk/blob/master/Lib/Teams.ahk https://tdalon.blogspot.com/2020/11/teams-shortcuts-smart-reply.html