Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use GeekTool to see new Mail messages on the desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use GeekTool to see new Mail messages on the desktop
Authored by: mainmode1 on Mar 31, '09 10:29:23AM
Slight improvement to number msg's and check unread count before looping:

set newline to ASCII character 10 
set finalText to "" 
 tell application id "com.apple.mail" 
  set unreadCount to (get unread count of inbox) 
  if unreadCount > 0 then 
    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 & i & ". " & fromMsg & newline & "      " & subjMsg & newline
    end repeat 
  else 
    set finalText to "No mail." 
  end if 
end tell 
finalText 


[ Reply to This | # ]