Unread Email Count

Posted in System by s_selling 2419 days ago

This ONLY works for OSX Mail. Feel free to change though.

I wanted a glet that gave me the unread email count for osx mail as i always have my dock hidden. The real work is done by the applescript file (mail_count.scpt) all the glet does is run it every 20 Seconds with a timeout of 3 seconds.

Feel free to use my glet, or add your own (shell). Also, check "mail_count.scpt" if you want to change the output or see how it works. By default if "Mail" is closed the script will run but it will not access any email and will no open the mail application, you can change this, but i would recommend it.

  1. Place "mail_count.scpt" somewhere safe (i.e. Dropbox, etc)

  2. Create a Shell Geeklet - Refresh Rate: 20 s Timeout: 3 s


    osascript /path/to/mail_count.scpt

    Mine is:

    osascript ~/Documents/scripts/mail_count.scpt
  3. Refresh All

If you see "Mail is not Running!"

Open Mail, and refresh

If Mail is running verify that the name is in fact "Mail.app" in the applications folder.

Thanks and i hope you all enjoy.

Geeklet files to download


User Avatar
s_selling 2418 days ago
Here is a pic of the 4 different states: [Mail is not running], [No unread messages], [You have 1 unread message], [You have 'X' unread messages].

![Unread Mail Count Screen shots](http://dl.dropbox.com/u/17626129/pic_01.png)
User Avatar
kroyster 2392 days ago
This script was extremely slow for me as it stepped through a thousand+ emails checking each for its unread status. I Googled and found the following one-line applescript that does the same thing in a fraction of the time.

tell application "Mail" to get the unread count of inbox

Log in to comment or register here.