At the moment, I’m running a “goodmorning” script at 7:00 AM every morning to get me up. It gives me weather, time, date, ect. But now I want it to tell me how many unread messages I have in my gmail and verizon email. So I need it to be able to be runned at any time to tell me how many unread messages there are.
It goes like this:
Install it with cron whenever you want to.
property finalText : {}
set newline to ASCII character 10
tell application "Mail"
set theAccounts to name of every account
repeat with anAccount in theAccounts
set theMboxes to every mailbox of account anAccount
set unreadCount to 0
repeat with anMbox in theMboxes
set unreadCount to unreadCount + (count (every message of anMbox whose read status is false))
end repeat
set finalText to finalText & (name of account anAccount) & tab & " : " & unreadCount & " unread messages " & newline
end repeat
end tell
tell application "TextEdit"
make new document
set the text of document 1 to finalText as text
end tell
By the way: I think you want this too, it is utterly cool! http://www.macscripter.net/viewtopic.php?id=33069
(But then you have to read your mail regurlarily, because
every mail who is not read is regarded as a new mail.