See comments hi after in the text.
…
==> INBOX
INBOX (y times)
As a side note: the name of a mailbox is already a string, so the "as string" part isn't needed here.
Yes! My last try in case…
But no names
But yes! "INBOX" is the name of each of these mailboxes.
They are distinguisable by the fact that they belong to differing accounts: mailbox "INBOX" of account "Gérard", maibox "INBOX" of account "Jules", and so on.
I finish by understand that.
Is it possible to obtain them otherwise?
I guess you are in fact thinking about the "custommailbox/submailbox/subsubmailbox" naming scheme.
But that seems to only apply to user-defined mailboxes, as a kind of shortcut.
The general rule for naming is: mailbox "subsubmailbox" of mailbox "submailbox" of mailbox "custommailbox" (with in this case the top-level piece being a mailbox, not an account).
By asking for
name of mailbox "custommailbox/submailbox/subsubmailbox"
you'll anyway get "subsubmailbox", not "custommailbox/submailbox/subsubmailbox".
No, I have already solved the case of mailboxes.
I try to obtain now all "sub-folders" of inboxes
Inbox and Sent have the same : accounts
Trash and Junk have also the same : accounts and "sur mon mac" which is specific (not Deleted Messages or Junk - I have tried).
I use the word "sub-folder" as an image for the hierarchical appearance in Mail.
But I know that it's not the same organisation than mailboxes.
____________
The last "gravel in my shoes".
Trash mailbox and Junk mailbox have a special "sub-folder" : "sur mon Mac"
I don't know the "real" name for using it in Applescript (to select it).
In the case of the Trash for example, this should be
mailbox "Deleted Messages"
which contains every messages deleted from local mailboxes.
You may find it by asking for "every mailboxes" (i.e. the mailboxes that are elements of Mail).
No, cf upper
Trash=Trash/sur mon Mac + Trash/Gérard + Trash/John + …
Trash ≠ Trash/sur mon Mac
What is the real name for "sur mon Mac"? I haven't tried "on my Mac"…
The problem is that there are several layers to be taken in account.
Application level: when creating an account, that account potentially may have several mailboxes, according to the kind of account (POP, IMAP...); by creating a local (i.e. custom, "sur mon Mac") mailbox, one is organizing local storage of messages according to the user's fantasy.
GUI level: for example, it may appear sensible to group all deleted messages under a same "visual container", such as the Trash, even if the mailboxes are possibly very different (deleted messages on an IMAP server may be on the server and never be stored locally).
AppleScript object model level: the model must allow to access all mailboxes, without losing the specifics of ecah mailbox considered individually; hence the account-related mailboxes, managed by the application itself (and accessed through properties of the application), and the user-defined mailboxes (accessed as elements of the application).
In the hope I managed to write something legible...
I understand it!
Thanks for the time that you pass for that.