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


Click here to return to the 'New mail notification using the PowerMate' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
New mail notification using the PowerMate
Authored by: craigp on May 19, '08 06:02:16AM
I did some work on this, as none of the solutions really did what I wanted. I wanted Mail.app to fire off a script when new mail came in, set the throb, then keep checking until I read the new mail. This script will do that, and then get itself in to a checking loop until you read the email, at which point the script will exit. In other words, you won't need to have a script running all the time.

-- say "Checking email"
set shouldContinue to 1
repeat while shouldContinue is 1
	try
		tell application "System Events" to if (exists process "Mail") is false then
			set theCount to 0
		else
			tell application "Mail" to set theCount to unread count of inbox
		end if
		if theCount > 0 then
			tell application "PowerMateDaemon" to set pulse always to true
			--say "Unread email found"
		else
			tell application "PowerMateDaemon"
				set pulse always to false
				set brightness to 0
				set shouldContinue to 0
				--say "No more unread email"
			end tell
		end if
	end try
	delay 2
end repeat
--say "Finished"


[ Reply to This | # ]
New mail notification using the PowerMate
Authored by: craigp on May 19, '08 06:04:00AM

Oooh. Forgot to say: you will want to use Script Editor to create this script, save it somewhere, then create a new rule in Mail.app for 'Every message' that fires this scripts. Job done.



[ Reply to This | # ]