Re: Get unread message count from Mail.app
Re: Get unread message count from Mail.app
- Subject: Re: Get unread message count from Mail.app
- From: Philip Aker <email@hidden>
- Date: Sat, 16 May 2009 13:42:08 -0700
On 2009-05-16, at 13:15:59, Michelle Steiner wrote: On May 16, 2009, at 11:40 AM, Philip Aker wrote: "Get Mail's unread message count so it matches the number on its icon badge in the dock." In 10.5, the user can choose whether the number shown on the Dock is all unread messages, just the unread ones in the inbox, or none at all.
1. Too slow
tell application "Mail" to count (every message of every mailbox whose read status is false)
This took less than one second for me:
--set a to current date tell application "Mail" tell mailboxes count of (messages whose read status is false) end tell end tell --(current date) - a
Mac OS X10.5.7, mail 3.6 (935/935.3) iMac Core 2 Duo, 2.06 GhZ (Last of the "white" modes before the silver ones). It's the only one I have, so the only one I could test.
Unfortunately: tell application "Mail" tell mailboxes set urc to count of (messages whose read status is false) end tell end tell {urc, (current date) - a}
--> {1299, 27}
takes 27 seconds on my setup. Insufferable for the OP (who wants to create a Dock-like application).
ยง
The problem (with tell application "Mail" to set res to unread count of mailboxes variants) as reported is:
"That's not working correctly for me at all. "mailboxes" is only returning {mailbox "ToDos" of application "Mail", mailbox "Outbox" of application "Mail", mailbox "Deleted Messages" of application "Mail"}, which is far from correct"
So I'm trying to determine how he has arrived at an account/mailbox setup which would give him an invalid count when mine is 100% accurate.
Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@ Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
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