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: parraccourci on Apr 01, '09 05:02:10AM
In case you don't want Mail to be lunched every time the script is executed by GeekTool, use this script:
set newline to ASCII character 10
tell application "System Events" to set iCalIsRunning to (name of processes) contains "Mail"
set finalText to ""
if iCalIsRunning then
	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)
				if subjMsg = "" then
					-- do something really important here
					
				else
					set subjMsg to newline & "     " & subjMsg
				end if
				set finalText to finalText & i & ". " & fromMsg & subjMsg & newline
			end repeat
		else
			set finalText to "No new mail"
		end if
	end tell
else
	set finalText to "Mail not open"
end if
finalText


[ Reply to This | # ]