Show summaries of Mail's flagged emails on the Desktop

May 13, '10 07:30:01AM

Contributed by: dushu

[Note: This hint originally ran in mid-March, but was marked "must be logged in to read." As a result, it didn't go out in the RSS feed, and not many people saw it. I'm republishing it so that everyone has a chance to see it. -craig.]

I flag mail which I need to respond to, however, many times I forget to check my Flagged Mail mailbox. To keep these flagged mails visible, I finally sat down and -- with lots of help from the internet -- created the following AppleScript. With the help of Geektool, I now have the sender and subject of flagged mails visible on my desktop.

Here's the script:

set newline to ASCII character 10

set finalText to "Flagged Mail:" & newline
tell application "Mail"
  set theMessages to every message in inbox whose flagged status is true
  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 & ": " & subjMsg & newline
  end repeat
end tell
finalText
Save this file as an AppleScript; I named mine flagged mail.scpt. In Geektool, add a Shell Geeklet with the following code:
osascript ~/Documents/Workflows/flagged\ mail.scpt
Hope this helps someone in the same situation as me.

[robg adds: This worked as described for me.]

Comments (13)


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