• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get unread message count from Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 15:30:35 -0700

On 2009-05-16, at 15:21:01, Philip Aker wrote:

set sum to 0
tell application "Mail"
set res to {}
set res to unread count of every mailbox
repeat with i in res
set sum to sum + i
end repeat
if (sum is 0) then
set alist to every account whose enabled is true
repeat with af in alist
set res to unread count of mailbox "INBOX" of af
end repeat
end if
sum
end tell

= WRONG

I think it's better stated as:

tell application "Mail"
set sum to 0
set res to {}
set res to unread count of every mailbox
repeat with i in res
set sum to sum + i
end repeat
set alist to every account whose enabled is true
repeat with af in alist
set sum to sum + (unread count of mailbox "INBOX" of af)
end repeat
return sum
end tell


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

  • Follow-Ups:
    • Re: Get unread message count from Mail.app
      • From: Peter Baxter <email@hidden>
References: 
 >Get unread message count from Mail.app (From: Philip Aker <email@hidden>)
 >Re: Get unread message count from Mail.app (From: Michelle Steiner <email@hidden>)
 >Re: Get unread message count from Mail.app (From: Philip Aker <email@hidden>)
 >Re: Get unread message count from Mail.app (From: Deivy Marck Petrescu <email@hidden>)
 >Re: Get unread message count from Mail.app (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Get unread message count from Mail.app
  • Next by Date: Re: Get unread message count from Mail.app
  • Previous by thread: Re: Get unread message count from Mail.app
  • Next by thread: Re: Get unread message count from Mail.app
  • Index(es):
    • Date
    • Thread