Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

playing sound files with applescript in snow leopard

My old reliable, "Play Sound," apparently doesn't work with 10.6.3 (or 10.6.x in general). Can you suggest a simple alternative?

Example:

tell application "?"
play file ((path to desktop as Unicode text) & "Sound Files:doorbell.wav")

end tell


Message was edited by: osimp

Message was edited by: osimp

Intel Mac Pro, Mac OS X (10.6.3)

Posted on Apr 21, 2010 2:38 PM

Reply
Question marked as Best reply

Posted on Apr 21, 2010 3:00 PM

afplay comes installed on Snow Leopard

/usr/bin/afplay
4 replies

Apr 21, 2010 3:08 PM in response to osimp

Some time ago I wrote a CGI-Script, that I could trigger through a simple WEB-Request. This CGI-Script was just some AppleScript (through oasascript-command) to set up the server's sound-volume and for playing a sound through the command line-app.
I used a small example-app Apple greated (X-Code command line app-example) which is called Ascii-movie-player.
When you open a quicktime-movie using this app in your terminal, it trys showing it using ascii-characters, but it works with simple soundfiles (quicktime is able to play), too.

I compiled it for PPC so it should work, when Rosetta ist installed. For more info take a look at
http://hubionmac.com/wordpress/2008/10/alarm-ton-bei-aufruf-einer-website-panic- button-20/
There you will find a copy of the source and a compiled version (CGI-Alarm)

e.g. you saved the player binary at /usr/local/bin/player
do shell script "/usr/local/bin/player ~/Music/doorbell.wav"

should work

playing sound files with applescript in snow leopard

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.