convert output to plain text (xy of xy of xy)


is there a way to convert applescript output like this into unicode text?

{message id 179928 of mailbox “INBOX” of account “googlemail” of application “Mail”}

What I want is the information “googlemail” and “INBOX” as plain text.


I’m not sure there isn’t a better way, but here’s a crude solution to get the names you want.
Note the snippet only works when one message is selected.
“As alias” has no meaning in Mail - you cannot turn that reference into text.
So you have to Munchausen your way up from the message to the account.

tell application "Mail"
	set {thisMsg} to selection
	set theMailbox to mailbox of thisMsg
	set theaccount to account of theMailbox
	name of theMailbox
	name of theaccount
end tell

Anyone know a better way?