I have yet come up with a script that allows me to play system sounds.
OS9 twas easy
tell application "Finder" to play sound "Boing"
Now how would I get my alert sounds happening?
Beep = “Boring”
I like my scripts to come alive. 8)
I have yet come up with a script that allows me to play system sounds.
OS9 twas easy
tell application "Finder" to play sound "Boing"
Now how would I get my alert sounds happening?
Beep = “Boring”
I like my scripts to come alive. 8)
As far as I know, “play sound” is not a Finder command, but a “Jon’s Commands” one…
You can d/l latest version for OS X at http://www.seanet.com/~jonpugh/
I don’t know if this command still works ok at os x… But you could also try X-Commands/Extra Suites, which includes a command to play sounds http://www.kanzu.com/
Jon’s Commands’ play sound works great. You can’t use the system sound directly but need to use the reference to the system sound.
On my way… thanks guys!
Just got Jon’s Commands working but after my update of system 10.2.4 it doesn’t seem to work anymore… any ideas?
Hi I just tried it on 10.3.2 and it gave me “end of file” error. Here is the code:
play sound posix file “/System/Library/Sounds/Sosumi.aiff”
Am I missing anything here? Thanks!
Ok just spotted this in the document:
“Note that under Mac OS X, there are no system resources, so include your sound resources in your applet. At this time, AIFF files are not supported.”
I use this to play an hourly chime:
– this script has the Size resource modified for background
on run
set cur_date to (current date)
set cur_time to (time of cur_date)
set cur_hours to (cur_time div hours) mod 12
if cur_hours is 0 then set cur_hours to 12
repeat cur_hours times
play sound file “Macintosh HD:Users:kel:Library:Sounds:Purr.snd”
end repeat
end run
on reopen
run
end reopen
Note that the sound file is a system sound file. You need to convert an aiff or use one of the old system sounds. There are a lot of apps that can convert aiff to snd.
gl,
Here is an Applescript studio app I wrote. You can download the sourcecode and play with it.
Thank you for sharing the code. I tried to build it but I got this error:
Missing file or directory: /Users/kerim/Documents/My Documents/Projects - Current/Unfiled and In Progress/Scripting/Read Me.rtfd
Also, from the source it looks like it’s using ASS’s sound functions (load sound, etc.). I’m actually looking for a way to play sound files from an AS script - so I can play it, for example, from command-line or from my shell script, without firing up another app (at least without users knowing).
This is a thread I started in ASS forum. Haven’t got any suggestion yet.
Also, from my other post, if you want to play an aiff without converting to a system 7 sound file, you can use the freeware app Play Sound:
http://microcosmsoftware.com/playsound/
It is a background app, but I don’t know if it may still notify you if you’re playing a game or something in another app. Something like this:
tell application “Play Sound”
play “Macintosh HD:Users:kel:Desktop Projects:Glass.aiff”
end tell
It’s icon looks like a scripting addition, but it is an application. Also, if your script is an application, then you need to modify it’s Size resource to background only otherwise the system will notify you that the script needs your attention. There are also a freeware app on the Internet that changes scripts to background only. I think It’s called Bacgrounder or somthing like that.
gl,
Also, from my other post, if you want to play an aiff without converting to a system 7 sound file, you can use the freeware app Play Sound:
http://microcosmsoftware.com/playsound/
It is a background app, but I don’t know if it may still notify you if you’re playing a game or something in another app. Something like this:
tell application “Play Sound”
play “Macintosh HD:Users:kel:Desktop Projects:Glass.aiff”
end tellIt’s icon looks like a scripting addition, but it is an application. Also, if your script is an application, then you need to modify it’s Size resource to background only otherwise the system will notify you that the script needs your attention. There are also a freeware app on the Internet that changes scripts to background only. I think It’s called Bacgrounder or somthing like that.
gl,
Yup this is a very useful little gem. However I don’t know if it can be freely distributed with a GPL’ed app. I wrote to the developer and hopefully I’ll get a reply soon.
(I’ll write it if I know how)
Also, from my other post, if you want to play an aiff without converting to a system 7 sound file, you can use the freeware app Play Sound:
http://microcosmsoftware.com/playsound/
It is a background app, but I don’t know if it may still notify you if you’re playing a game or something in another app. Something like this:
tell application “Play Sound”
play “Macintosh HD:Users:kel:Desktop Projects:Glass.aiff”
end tellIt’s icon looks like a scripting addition, but it is an application. Also, if your script is an application, then you need to modify it’s Size resource to background only otherwise the system will notify you that the script needs your attention. There are also a freeware app on the Internet that changes scripts to background only. I think It’s called Bacgrounder or somthing like that.
Thanks kel… it works kewl!