Reputation: 4766
I have created a hotkey that I want to use only in MS Teams (workaround for the lack of 'Reply to message' function).
I assigned it to Ctrl+R, however it seems that it prevents other applications that use the same combination from noticing the hotkey.
The code is below:
^r::
if WinActive("ahk_exe Teams.exe")
{
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
}
return
Is there a way to tell AHK to let the key combination bubble up when the active app is NOT teams?
I tried adding an 'else' clause in which I would Send, ^r
but that didn't work.
Upvotes: 1
Views: 316
Reputation: 4766
Actually, I got it. Posting the working solution.
It seems I needed to wrap the hotkey declaration within the #ifwinactive directive.
#IfWinActive("ahk_exe Teams.exe")
^r::
SoundBeep 200,500
Send, ^c
Send, {Tab}
Send, >
Sleep, 500
Send, ^v
Send, {Enter}
Send, {Enter}
return
#IfWinActive
An even better, comprehensive solution and more powerful approach by @ThierryDalon - https://github.com/tdalon/ahk/blob/master/Lib/Teams.ahk https://tdalon.blogspot.com/2020/11/teams-shortcuts-smart-reply.html
Upvotes: 1