Re: On My Mac
Re: On My Mac
- Subject: Re: On My Mac
- From: Deivy Marck Petrescu <email@hidden>
- Date: Mon, 1 Jun 2009 17:25:33 -0400
On Jun 1, 2009, at 14:55, Luther Fuller wrote:
I've been working on my On_My_Mac handler (below) yesterday
afternoon and all this morning. I haven't been able to improve on
the old original, but I did make some minor changes. I did discover,
using
set mboxName to (name of selMailbox)
that:
The Inbox is named "Inbox" and its sub-mailboxes are named "INBOX";
The Sent mailbox is names "Sent" and its sub-mailboxes begin with
"Sent Messages";
The Trash mailbox is named "Trash" and its sub-mailboxes begin with
"Deleted Messages";
The Junk mailbox is named "Junk" and its sub-mailboxes begin with
"Junk";
The Drafts mailbox is named "Drafts" and its sub-mailboxes begin
with "Drafts".
Mailboxes "On My Mac" have no account.
(But I have encountered error messages that seem to refer to an "On
My Mac" account.)
And now my question: Isn't there a simple way to determine if a
mailbox is "On My Mac"?
(I've been looking for a long time, but have found nothing.)
on On_My_Mac(mbox) -- mbox is a Mail mailbox.
tell application "Mail"
try
set mboxName to (name of mbox) as text
on error
return false -- RSS
end try
if mbox is trash mailbox then return false
if mbox is inbox then return false
if mbox is sent mailbox then return false
if mbox is drafts mailbox then return false
if mbox is junk mailbox then return false
if mbox is outbox then return false
end tell
--
repeat
tell application "Mail"
try
set acnt to (account of mbox)
name of acnt
account type of acnt
return false -- mailboxes On My Mac have no account
end try
end tell
--
if first character of mboxName is in {"I", "D", "J", "N", "O",
"S", "T"} then
if mboxName is "INBOX" then return false
if mboxName starts with "Deleted Messages" then return false
if mboxName starts with "Drafts" then return false
if mboxName starts with "Junk" then return false
if mboxName starts with "Notes" then return false
if mboxName starts with "Outbox" then return false
if mboxName starts with "Sent Messages" then return false
if mboxName starts with "ToDos" then return false
end if
--
try
tell application "Mail"
set outerBox to mbox
set mbox to (container of mbox) -- error here if no outer mailbox
set mboxName to (name of mbox) as text
end tell
on error
exit repeat
end try
end repeat
--
return true
end On_My_Mac --------------------------------------
Luther,
I ran this
tell application "Mail" to get container of mailbox 1
-->account "On My Mac" of application "Mail"
So you'd say "aha! `On My Mac' is an account..."
I tried to run
try
tell application "Mail" to get mailbox of account "On My Mac"
on error e
return e
end try
-->"Mail got an error: Can’t get account \"On My Mac\"."
Then I realize I do not have an "On My Mac" I can not go any further,
but may be you can!
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >On My Mac (From: Luther Fuller <email@hidden>) |