Switching to the first tab in Mail using Applescript or Shell
1
vote
1
answer
185
views
I am looking for a way to switch to the first tab in a Mail window. It seems like there is no universal way to address tabs in macOS programmatically. I have tried Apple scripting with and without using "System Events", but with no luck. And most scripts on the net are regarding Safari.
These do not work:
I have traversed the Applescript Dictionary but cannot find anything suitable. Any hints would be appreciated. It would also be nice to know if it can be solved using Shell since I am going to use it for a Keyboard Maestro action.
tell application "System Events" to tell process "Mail" to tell window 1 to tell radio button 1 to click
tell window 1 of application "Mail" to set current tab to tab 1
It seems like Mail handles the tabs as if they were windows. But this does not help since the indexes of the windows/tabs shuffle around depending on how they are set up, whichever tab was selected last etc., and I always want to address tab #1 independent of the window index number and name/contents.

Asked by max1mvs
(39 rep)
Sep 28, 2022, 05:41 AM
Last activity: Jun 20, 2025, 01:02 PM
Last activity: Jun 20, 2025, 01:02 PM