CaptainBeardsEyesBeard Posted July 20, 2022 Share Posted July 20, 2022 Hi, 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") WinActivate($appHandle) If @error then Msgbox64, "", "Can't see teams") WriteToConsoleAndLog("Error activating window $appHandle") endif WriteToConsoleAndLog("Activating window for $appHandle2") WinActivate($appHandle2) If @error then Msgbox64, "", "Can't see teams") WriteToConsoleAndLog("Error activating window $appHandle2") endif exit 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 More sharing options...
rsn Posted July 21, 2022 Share Posted July 21, 2022 (edited) 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 July 21, 2022 by rsn Testing and added note Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now