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

Create audible alerts for Mail.app Apps
After leaving Eudora behind for Mail.app, I keep finding features I miss -- in this case, Eudora's ability to read the "From:" header as mail comes in. I had it set in some filters to give me an audio heads-up when certain folks sent mail.

As far as I can tell, this isn't available in Mail.app, but a workaround is possible using AppleScript using the basic text-to-speech script.
  1. Make the sound file in AppleScript:
    on run
    set theText to "You've got mail from yo momma."
    say theText using "Victoria" saving to "YoMomma.aiff"
    end run
    Save and run this AppleScript to create the sound file.

  2. Put the resulting file in ~/Library/Sounds.

  3. In Mail -> Preferences -> Rules, Add or Edit the Rule you wish to add the sound to.

  4. Add an Action of "Play Sound," and select "Add/Remove" at the bottom of the list. Your new sound sound shows up. Highlight it and click "Done."
That's it! You should now get a nice audio indication when mail matching your rule criteria arrives!
    •    
  • Currently 2.00 / 5
  You rated: 2 / 5 (2 votes cast)
 
[6,723 views]  

Create audible alerts for Mail.app | 17 comments | Create New Account
Click here to return to the 'Create audible alerts for Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script fails syntax check for me, 10.1.5
Authored by: osxpounder on Sep 23, '02 11:04:05AM
on run
	 set theText to "You are my liege lord and righteous lawgiver, master of all that you survey! What is your pleasure, O mighty one?"
	 say theText using "Victoria" saving to "YouRule.aiff"
end run
In any case, when I try this script, it fails. Script Editor says, "Unexpected end of line, etc. but found identifier." It highlights the word 'saving' in the script.

Any clues why this won't work for me? Where's my goof?

osxpounder

[ Reply to This | # ]

Script fails syntax check for me, 10.1.5
Authored by: piper on Sep 23, '02 11:16:56AM

I have the exact same problem here, and I need to figure it out so I can prank my friend!

J



[ Reply to This | # ]
Script fails syntax check for me, 10.1.5
Authored by: piper on Sep 23, '02 12:05:41PM
Figured it out! Gotta be running X.2! I was using a friend's computer with 10.1.x and when I went back to my own computer running X.2 it worked fine. According to Apple's Applescript web site, this is a new feature of speach in Applescript. http://developer.apple.com/ue/speech/applescript.html Therefore, use an OSX.2 box to create the sound, THEN you can put the sound ony any computer! J

[ Reply to This | # ]
Mail does have this option
Authored by: BMarsh on Sep 23, '02 11:45:02AM

At least in 10.2, Mail.app has this option.

You can set Mail.app

If "any" of the following conditions are met:

then set "From" then "Contains" then "whatever address you want it to look for"

Perform the following actions:

change this option to "play sound"
it has a list of default system sounds, and an option to "add/remove"



[ Reply to This | # ]
Mail does have this option
Authored by: BMarsh on Sep 23, '02 11:47:03AM

never mind, I didn't read the original hit clearly enough
ignore my post



[ Reply to This | # ]
AppleScript used just for creating the sound file
Authored by: hayne on Sep 23, '02 01:24:30PM

AppleScript.is not an essential part of this hint. It is rather misleading to say that AppleScript was used as a "work-around". AppleScript was only used to create the sound file. The sound file can instead be created by any audio program.

The essence of this hint is that you can make your own sound files and then use then in Mail.app.



[ Reply to This | # ]
Applescript
Authored by: bih on Sep 23, '02 02:08:01PM

Is there a way to get the address of the sender announced when a new message is recieved? This would be really cool.



[ Reply to This | # ]
Applescript
Authored by: hayne on Sep 24, '02 03:52:22AM

As far as I can see, there is no way to get Mail.app to run an applescript when a new message is received.
Otherwise something like the following applescript might work:

tell application "Mail"
set selectedMessages to selection
repeat with theMessage in selectedMessages
set theSender to the sender of theMessage
set theSubject to subject of theMessage
say "New message from '" & theSender & "'"
say "Subject: " & theSubject
end repeat
end tell

Entourage does support running an applescript as part of a rule, so this sort of thing is easy to do in Entourage. Here's the script you can have an Entourage rule run: (You need to save it as a compiled script using Script Editor or Smile, etc.)

tell application "Entourage"
set selectedMessages to current messages
repeat with theMessage in selectedMessages
set theSender to the display name of sender of theMessage
set theSubject to subject of theMessage
say "new message from '" & theSender & "'"
say "Subject: " & theSubject
end repeat
end tell



[ Reply to This | # ]
full path to .aiff file
Authored by: mervTormel on Sep 23, '02 02:55:03PM

i want to point out here that the yomamma script is going to try and write that .aiff file to the root dir / and if your account does not have write access, the sound file doesn't get written and the script doesn't complain (at least, not here).

you'll want to use the full path name to the intended sound file, e.g.,

"Users:yourUsername:soundFileName.aiff"

editorial: i consider this omission rather poor form; full paths to filenames, people!



[ Reply to This | # ]
full path to .aiff file
Authored by: Chas on Sep 23, '02 08:50:03PM

Hey thanks Merv, that path did the trick. I tried putting in a POSIX path but it didn't like that, I forgot Applescript uses the : notation. Now I can program incoming mail to report "You've Got Veal!" (apologies to Dave Letterman for stealing his joke.. I love that one)..



[ Reply to This | # ]
A great program to use instead.
Authored by: nakedgremlin on Sep 23, '02 03:29:35PM
A great program to use instead of fiddling with AppleScript would be SpeakNSave -- it gives you a nice GUI for making/saving speeches.

[ Reply to This | # ]
AT&T Natural Voices
Authored by: Anonymous on Sep 23, '02 07:56:35PM

Another fun alternative is to use AT&T's Natural voices website to generate aiff files with one of their two voices. Most people would agree that they sound much better than the built in voices included with Mac OS.

http://www.naturalvoices.att.com/demos/index.html

Nathan



[ Reply to This | # ]
NeXT Sound file
Authored by: rdogra on Sep 23, '02 08:46:21PM

Here is a snd file that NeXT users used before
AOL.

ftp://ftp.peak.org/pub/next/sound/soundfiles/y/YouHaveNewMail.snd



[ Reply to This | # ]
NeXT Sound file
Authored by: beastie on Sep 24, '02 08:55:47AM

what player will play that .snd thing?



[ Reply to This | # ]
NeXT Sound file
Authored by: marmoset on Sep 24, '02 10:04:25AM

Rename it to YouHaveNewMail.au
(it's a Sun mu-law file)



[ Reply to This | # ]
AT&T Natural Voices
Authored by: iRoid on Feb 07, '03 10:38:29PM

How do you save the sample as a file?



[ Reply to This | # ]
Perhaps this is more your speed...
Authored by: Moofisto on Sep 24, '02 03:49:58PM

http://www.crankyank.com/sounds/Special%20Ed%20-%20I've%20Got%20Mail.wav

;)

NB: http://www.crankyank.com/videos/Special_Ed-Ive_Got_Mail.mpg



[ Reply to This | # ]