In MS Teams new meeting experience the meeting it self always opens in a separate window, which I'd like to make active via apple script to be able to thereafter trigger a shortcut.
That way I can be in any other app and execute this for hotkey commands to work.
The meeting window title will always be unique as it uses the meeting title. Can we in just tell it to switch to the second window via applescript (regardless off title)?
I only managed to use AXRaise and cycle through the windows, but I need to always raise it and select the second window in the list. Is there another way or do i need to click the menu item somehow and use arrow key down?
tell application "System Events" perform action "AXRaise" of window 2 of process "Microsoft Teams" end tell
EDIT 2: just to be clear I need to target the same 2nd window each time (since the hotkey only work in the meeting window).
I also tried suggested solution below which does the same, cycling through the window, each time revealing the next one.
tell application "System Events" tell application process "Microsoft Teams" perform action "AXRaise" of window 2 set frontmost to true end tell end tell
tell application "System Events" to ¬ perform action "AXRaise" of window 2 of ¬ application process "Microsoft Teams" tell application "Microsoft Teams" to activate
EDIT 3 - Solution
The Solution below works via UI but if there is another way without visually going through the dock menu that would be better, since once I executed it and are active in the window i no longer need to use it. (unless there is an if condition i can use to only trigger it if that window is not already active). I also found a better solution via app main menu see below.
However I'd still like to know if there is another/better way to specifically target a window i.e. second window of an app without using any menus.