I am looking for a way to expand or collapse the mailbox list in the Apple Mail Sidebar. I've looked everywhere, and tried to use UI Browser to help with an AppleScript, but couldn't figure it out.
Any suggestions?
I am looking for a way to expand or collapse the mailbox list in the Apple Mail Sidebar. I've looked everywhere, and tried to use UI Browser to help with an AppleScript, but couldn't figure it out.
Any suggestions?
To clarify, do you mean clicking this disclosure triangle to toggle visibility of all your account inboxes?
UI Browser gave me the following line for my All Inboxes folder...
click UI element 2 of UI element 1 of row 2 of outline 1 of scroll area 1 of splitter group 1 of window 1
...and the following works to close/open it.
tell application "System Events"
tell application process "Mail"
click UI element 2 of UI element 1 of row 2 of outline 1 of scroll area 1 of splitter group 1 of window 1
end tell
end tell
Yes, I can see that this works for “All Inboxes”. Thank you.
But I’m focused on higher number rows in the outline. Specifically, I want to collapse the lists of all the accounts, e.g. “iCloud” and the rest of the accounts.
So, in pseudo-code:
Set accountList to
Repeat for each account XX in accountList
click on UI element 2 of UI element 1 of row of outline 1 of scroll area 1 of splitter group 1 of window 1
End repeat
No. It’s for the accounts listed lower in the sidebar.
Also, on Ventura, if “All Inboxes” is collapsed, the second script doe NOT expand it.
Just to confirm Ike, are you referring to the accounts the red arrow points to, and the disclosure triangle the orange arrow points to?
Confirmed.
Unfortunately those disclosure triangles are dynamic and only generated when you hover your mouse over the mailbox in question. I see no way of scripting this with either GUI nor with Mail’s AppleScript library. You could check over at the Late Night Software forum because they have some AppleScript geniuses over there (we have them here too of course, and some of them might chime in still).
Thank you. At least you’ve confirmed it is a difficult problem.