Scripts can't run the View tab's window commands (Switch Windows, New Window, Hide, Unhide): they change the active workbook, as window.* steps do. The Switch Windows button names its accessibility role with egui::Role (egui 0.37).
table