Last active
April 1, 2018 14:34
-
-
Save youandhubris/321bc80e38806dba2bf1d77fc3f54aa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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