I often walk away from my desk (and computer) for a bit of time. When I get back, I have to interrupt the screensaver to see if I received any mail while I was away. I always wished the screensaver could just let me kow and save me the trouble of having to unlock my computer to find out. It turns out this is very simple in OS X. Here is what I did with a few minutes worth of learning AppleScript. (I am sure more experienced folks can find more elegant solutions.)
Here's the four-step solution:
repeat
tell application "Mail" to set TotalNumberofnewmessages to unread count of inbox
if (TotalNumberofnewmessages is greater than 0) then
do shell script "cp ~/youhavemail.jpg ~/screensaverpix/pix1.jpg"
do shell script "cp ~/youhavemail.jpg ~/screensaverpix/pix2.jpg"
else
do shell script "cp ~/youhavenomail.jpg ~/screensaverpix/pix1.jpg"
do shell script "cp ~/youhavenomail.jpg ~/screensaverpix/pix2.jpg"
end if
delay 70
end repeatMac OS X Hints
http://hints.macworld.com/article.php?story=20060914134524613