Use GeekTool to see new Mail messages on the desktop

Mar 31, '09 07:30:00AM

Contributed by: Anonymous

I use GeekTool a lot, and one of the things I use it for is to display my new email messages on the desktop. To do that, I use this AppleScript:

set newline to ASCII character 10

set finalText to ""

tell application "Mail"
  set theMessages to (messages of inbox whose read status is false)
  repeat with i from 1 to number of items in theMessages
    set thisMessage to item i of theMessages
    
    set fromMsg to (sender of thisMessage as string)
    set subjMsg to (subject of thisMessage as string)
    set finalText to finalText & "- " & word 1 of fromMsg & " " & word 2 of fromMsg & newline & "     " & subjMsg & newline
    
  end repeat
end tell
finalText
In GeekTool, I created a new entry and set the pop-up to Shell. On the Command tab, I entered the command as osascript /path/to/mailcheck.scpt (replace with the path and name of your own AppleScript).

This works well for me, though I am sure it could be made a little more useful by others. It was my first AppleScript -- what a strange language!

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090327162020498