Thanks very much for the answer @NigelGarvey
The script that relies on throwing an error which is caught and then processed by getting every sixth item doesn’t work on Mail 14 because the error message thrown is the one I show, which must be different than that in Mail 16.
I was indeed wanting to get the path to where the mailbox is stored on disk.
I think my initial attempts didn’t work because it seems that I have to have the processing within the “tell application Mail”, and it works when I use explicit bracketing, like this
tell application "Mail"
set accountsMailboxes to accounts's mailboxes
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to quote
-- All accounts.
repeat with mailboxlist in accountsMailboxes
repeat with themailbox in mailboxlist
set accountid to account of themailbox
set thedirectory to account directory of (account of themailbox)
set thepath to POSIX path of (account directory of (account of themailbox) as string)
set x to do shell script "ls -lr " & thepath
display dialog x
end repeat
end repeat
end tell
This now works, but isn’t quite what I want.
However, as you say, it only seems to be possible to get the disk folder for an account . In the example, I have three folders in the account (INBOX, Drafts and Sent Massgaes or something) and hence the above gives the three paths (for the account) three times, but not the path to the specific INBOX directory (or whatever).
But what I actually want is the POSIX path to the mailbox I have selected in the Mail sidebar. I have got
set theList to {}
tell application "Mail"
set theviewer to message viewers
set sel to selected mailboxes of message viewer 1
This works fine to get the selected mailbox “on My Mac” which happens to be Mailboxes/Friends/family/joe". But this mailbox On My Mac does not have an account, so even if account gives the right mailbox paths for that mailbox, this would be no good because the mailbox On My Mac doesn’t have an account! So I don’t know how to get the path of a mailbox - the original question!
Finally, my question about the double chevrons (which were munged by the markup) was about what class seld meant, but I now understand that was just a placeholder, thanks.