Checking the Meeting Status of Microsoft Teams

I would like to create a macro that checks whether I am currently in a Microsoft Teams Meeting.

Since Teams has two open windows when in a call (one for the call and another 'main' window), I'd like to count the number of windows for that application. I'd use the result inside an If block.

Alternatively maybe I can check all windows and count how many have "| Microsoft Teams" in their title?

Ah, I just found WINDOWCOUNT()

This should do the trick.

Why not check just the front most window for its title using the %FrontWindowName% text token?

See the wiki page token:Window Tokens [Keyboard Maestro Wiki]

Because the title of a Teams window doesn't tell me whether a video call is open. I could use Find Image now I think of it, but WINDOWCOUNT() is working great.

This is how I'm using it to set my external display to full brightness so that it provides lighting for my webcam.

When Teams opens a second window, I trigger a hotkey which is picked up by Lunar app to set the brightness to full.

When the window is closed, another hotkey tells Lunar to toggle back to adapting to the ambient light sensor on my MacBook.

I use a variable to keep track of the mode because otherwise Lunar toggles through various other modes each time it receives the global hotkey.


So, this didn't work out very well. KM often reports that Microsoft Teams has two windows, even after the meeting window has closed. I suspect there's a hidden window left around by Teams - perhaps a hack for doing screen sharing or on-screen annotations.

So I ended up using If the screen contain image instead. It's actually better this way because the display only goes to full brightness if I have the camera turned on in a meeting.