• 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: Apple Mail – Counting Unread Emails with System Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple Mail – Counting Unread Emails with System Events


  • Subject: Re: Apple Mail – Counting Unread Emails with System Events
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 17 Feb 2017 10:45:54 +0100

No need for Satimage.
We may do the job with Apple delivered tools.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/02/16 16:00
# dMod: 2017/02/16 16:17
# Appl: Mail
# Task: Get Count of Unread Email Messages
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Count, @Unread, @Mail, @Email, @Messages
-------------------------------------------------------------------------------------------
use AppleScript version "2.4" # ADDED
use framework "Foundation" # ADDED
use scripting additions # ADDED


tell application "System Events"
tell application process "Mail"
tell (first window whose subrole is "AXStandardWindow")
tell outline 1 of scroll area 1 of splitter group 1
tell rows 1 thru -1
tell first button of UI element 1
set unreadMail to its name
end tell
end tell
end tell
end tell
end tell
end tell

set unreadMail to text of unreadMail

set theArray to current application's NSArray's arrayWithArray:unreadMail # ADDED
set theSum to (theArray's valueForKeyPath:"@sum.self") as integer # ADDED



Yvan KOENIG running Sierra 10.12.3 in French (VALLAURIS, France) vendredi 17 février 2017 10:45:34




 _______________________________________________
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: Apple Mail – Counting Unread Emails with System Events
      • From: Christopher Stone <email@hidden>
  • Prev by Date: The ASUL Archives are Back Up.
  • Next by Date: Re: set theAttachments to theMessage's mail attachments fails when called by a rule
  • Previous by thread: The ASUL Archives are Back Up.
  • Next by thread: Re: Apple Mail – Counting Unread Emails with System Events
  • Index(es):
    • Date
    • Thread