1
votes

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.

1
If you want a nice implementation of Microsoft Teams Smart Reply feature see the code here: github.com/tdalon/ahk/blob/master/Lib/Teams.ahk Demo is available here: tdalon.blogspot.com/2020/11/teams-shortcuts-smart-reply.htmlThierry Dalon

1 Answers

1
votes

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