July 1, 2022

Get Microsoft Teams Meeting Window using UIAutomation

I have shared previously how to get the active Teams meeting window with AutoHotkey with 2 ways: one prompting the user and an improved one using FindText.
I share now a better, more robust solution based on the UIAutomation library.

Key points

I identify the Teams meeting window by looking for an UIA Element with the AutomationId=microphone-button)
(TeamsEl.FindFirstBy("AutomationId=microphone-button"))

To exclude Meetings on-hold from the active meeting, I look for the existence of the Resume button by its Name. (TeamsEl.FindFirstByName("Resume"))

I check if the meeting window is minimized by the existence of TeamsEl.FindFirstByNameAndType("Navigate back to call window.", "button")

In case the meeting window is minimized, you might want to restore/ maximize it to access specific meeting actions only available in the maximized window.

This is why I have added the input arguments in the main function.

Implementation

The latest implementation is available in the Teams.ahk library -> Teams_GetMeetingWindow()
The implementation looks simply like this (Gist code below might be different from latest version in repo):


No comments:

Post a Comment