Skip to content

Instantly share code, notes, and snippets.

@youandhubris
Last active April 1, 2018 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youandhubris/321bc80e38806dba2bf1d77fc3f54aa8 to your computer and use it in GitHub Desktop.
Save youandhubris/321bc80e38806dba2bf1d77fc3f54aa8 to your computer and use it in GitHub Desktop.
# Mail Get Count to Clipboard
tell application "Mail"
# Get all local emailboxes
set emailBoxes to every mailbox
# Or Get From Specific User
# set userAccount to account "userName"
# set emailBoxes to every mailbox of userAccount
set emailBoxesCount to (count of emailBoxes)
if emailBoxesCount is greater than 0 then
# For each mailbox get Name & Count
set messageOut to ""
set i to 1
repeat with eachMailbox in emailBoxes
set mailboxName to name of eachMailbox
set mailCount to (count of (messages of eachMailbox)) as string
set messageOut to messageOut & mailboxName & ":" & mailCount
if i is not greater than or equal to emailBoxesCount then
set messageOut to messageOut & ", "
end if
set i to i + 1
end repeat
else
set messageOut to "null"
end if
set the clipboard to messageOut
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment