Dedicated Microsoft Teams mute toggle keyboard shortcut

Post your working scripts, libraries and tools
TheRandy
Posts: 1
Joined: 10 Dec 2020, 21:41

Dedicated Microsoft Teams mute toggle keyboard shortcut

10 Dec 2020, 21:51

I used AHK to create a dedicated Microsoft Teams mute toggle keyboard shortcut for my apps/menu key, but you can obviously modify the key to use any keyboard shortcut. It's not as straightforward as it seems because recent versions of teams potentially uses multiple windows, including the main Teams window, the meeting window, a notification window and a separate screen sharing window. The shortcut needs to select the appropriate Teams window to send the shortcut to. The keyboard shortcut can be sent to either the main window or the meeting window, but it has to ignore the notification and screen sharing windows.

It's currently working in Teams version 1.3.00.30866

Code: Select all

AppsKey::
WinGet, id, list, ahk_exe Teams.exe			;get IDs for all teams windows
Loop, %id% 							;Loop through IDs of all teams windows
{
this_ID := id%A_Index%
WinGetTitle, Title, ahk_id %this_ID%			;get the title of the current window
If Title <> Microsoft Teams Notification		;make sure title is not the notification
{
If Title <> 								;screen sharing win uses null title, make sure the win does not have a null title
{
WinActivate, ahk_id %this_ID%				;This should be the correct win, activate it
Send, ^M								;send ctrl,shift,m shortcut
break								;There are two teams windows, the main win and the meeting win, break the loop so that the mute commmand doesnt get sent twice
}
}
}

This post helped me put this script together: https www.lprp.fr /2020/03/keyboard-shortcut-to-mute-teams-with-autohotkey/ Broken Link for safety
aweinberg
Posts: 52
Joined: 08 Feb 2019, 15:38

Re: Dedicated Microsoft Teams mute toggle keyboard shortcut

14 Dec 2020, 17:14

Works for me, thanks for sharing!
User avatar
tdalon
Posts: 25
Joined: 21 Apr 2017, 07:19
GitHub: tdalon
Location: Germany
Contact:

Re: Dedicated Microsoft Teams mute toggle keyboard shortcut

27 Jan 2021, 08:54

See here for a library of Teams functions: https://github.com/tdalon/ahk/blob/master/Lib/Teams.ahk
Specially Teams_Mute() and Teams_GetMeetingWindow() (documentation here: https://tdalon.blogspot.com/2020/10/get-teams-window-ahk.html)
Your script here is not robust enough now that we can have multiple windows in Teams e.g. popped-out chat window and multiple meeting windows (on hold)
I like to run the Teams Mute feature from Teamsy https://tdalon.github.io/ahk/Teamsy via Executor.
mattyoh
Posts: 1
Joined: 27 Jan 2021, 06:26

Re: Dedicated Microsoft Teams mute toggle keyboard shortcut

28 Jan 2021, 04:54

This script works perfectly for me. Thank you!
Or rather for my wife now teaching online from home! Having seen her use Teams, little enhancements like this script are invaluable.
Programming a mouse button to activate the script works well for her but with this I noticed that while using Teams she is often now focussed on a different application eg Powerpoint or a Whiteboard so does not easily see the tiny 'mic' icon in Teams to ascertain if she is muted/unmuted. To help with this I added a simple
SoundPlay, %windir%\sound.wav
line to the script which is a great little audible confirmation the script has run, however, it still doesn't confirm whether muted or unmuted.

My question is this... is there a way for AHK to tell which state, muted or unmuted, Teams is currently in and then to use this info to play an appropriate audio file to indicate which.
Better still, would it be possible to create an on screen overlay over all other apps to indicate whether muted or not.

If anyone knows if or how this could be done or point me in the right direction, I would be very grateful.
User avatar
tdalon
Posts: 25
Joined: 21 Apr 2017, 07:19
GitHub: tdalon
Location: Germany
Contact:

Re: Dedicated Microsoft Teams mute toggle keyboard shortcut

10 Apr 2021, 03:46

@mattyoh Yes it is possible using FindText. See here https://tdalon.blogspot.com/2021/04/teams-shortcuts-mute-on-off.html with screencast.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 19 guests