Total AppleScript newbie/hack here. Last year I managed to cobble together the following script, which would speak the senders of new messages as they came into Mail.app (as long as Skype wasn’t running).
using terms from application "Mail"
on perform mail action with messages newMessages
tell application "System Events" to set theCount to the count of (processes whose name is "Skype")
if theCount = 0 then
repeat with newMessage in newMessages
tell application "Mail"
set senderName to (extract name from sender of newMessage)
say "New message from " & senderName
end tell
end repeat
end if
end perform mail action with messages
end using terms from
In Mail v5 (Lion), if two or more messages came in at the same time, the script worked well - it would speak the sender names one at a time, sequentially.
Now, in Mail v6 from the Mountain Lion GM, if more than one message arrives during a mail check, all the sender names are spoken at the same time, on top of each other, which sounds like a muddled mess.
Is there a simple way to make Mail v6’s behavior match v5? Any thoughts would be appreciated.