Is there a script to play a sound when the computer wakes from sleep?

Is there a script to play a sound when the computer wakes from sleep? I want to play a sound file when my computer comes back one… It doesn’t have to play from itunes… it can play from anywhere if that is easier to script. Does anyone have any ideas…

How about:

say "dum de dum dum dum do dum" using {"Cellos"}

for the sound, but you’ll need a third party app to run a script on wakeup. I use Scenario. Some others use SleepWatcher (which is a shell script).

A cheapo implementation (besides Adam’s free advice) would require a stay-open applet with the following code:
It assumes that sleep endures > 50 secs, but values can be adapted.


global checkT

set checkT to current date

on idle
if current date - checkT > 50 then say "dum de dum dum dum do dum" using {"Cellos"}
set checkT to current date
return 30
end idle

Thanks I will try these out… do you have a link for Scenario? I will also try the latter solution to to see what works best.

I have a MacMini in my car and when you turn the car on the Mini wakes… I want it to greet the driver when it turns on:

“Welcome to the Volkswagen Experience”

Geeky huh? I love it!

Elco,

Your Implementation works perfect, but… it repeats itself every 10 seconds… thats what I have the duration set to… anyway to have this stop after one execution… like stopping the loop. I don’t want to quite the app because it needs to run in the background for the next time. Let me know.

Thanks for this!

jderosa3 ,

The cycle should never repeat faster than the return value (30 secs in my case).
Make sure that the value checked against (current date - checkT), which was 50 in my case, is certainly higher than that or else the say command will be triggered everytime the idle loop runs !