Jump to content

Trying to activate Microsoft Teams window

Recommended Posts



I'm trying to activate this window (just scrubbed out the name in the title) 


With Teams it puts in the user name of the Title (making it annoying to automate)

so I'm trying to use WinGetHandle to activate the window. I don't get error in the console log though. 

Am I activating the window correctly? 

$appHandle = WinGetHandle("[CLASS:Chrome_RenderWidgetHostHWND1]")
$appHandle2 = WinGetHandle("[CLASS:Chrome_WidgetWin_1]")
WriteToConsoleAndLog("Activating window for $appHandle")
If @error then
   Msgbox64, "", "Can't see teams")
   WriteToConsoleAndLog("Error activating window $appHandle")

WriteToConsoleAndLog("Activating window for $appHandle2")

If @error then
   Msgbox64, "", "Can't see teams")
   WriteToConsoleAndLog("Error activating window $appHandle2")


And this is the console output. As you can see it does not hit the @error statements

The Teams window does not activate 

+Running: RegressionTests

Starting WA_Teams() functions
Activating window for $appHandle
Activating window for $appHandle2>Exit code: 0    Time: 24.84


Link to comment
Share on other sites

Maybe try:

Opt("WinTitleMatchMode", -2)     ; Matches any substring in the title, Case insensitive

and search for the window by name:

$appHandle = WinGetHandle ( " | Microsoft Teams" )
WinActivate( $appHandle )

Note that the Class for Teams is also shared by Chromium browsers. Edge, Chrome and Brave (to name a few) all have Class Chrome_WidgetWin_1 

Edited by rsn
Testing and added note
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...