If you can figure out how to get AppleScript to execute shell commands
like terminal does you could do
afplay /System/Library/Sounds/Frog.aiff
to play one of the system sounds, or specify the path to any sound file
you want. afplay uses CoreAudio so it should be able to play most common
file formats. It also has several options for playback speed, output
device etc.
For shutting down the terminal command would be just shutdown followed
by either -h -s or -r which stand for halt, sleep or restart so to do
what you want would be
shutdown -h
Note that all running apps will be asked to quit and they may do that or
they may ask to cancel the shutdown. For example, if you had an unsaved
state in an app, when it received the Quit request it might prompt you
to save or cancel. If you chose cancel the App might request the
shutdown to be canceled. That said, I did find some stuff for invoking
AppleScript from terminal which might include commands you could use
from here:
http://apple.stackexchange.com/questions/103571/using-the-terminal-command-to-shutdown-restart-and-sleep-my-mac
Shut down without showing a confirmation dialog:
osascript -e 'tell app "System Events" to shut down'
Shut down after showing a confirmation dialog:
osascript -e 'tell app "loginwindow" to «event aevtrsdn»'
Restart without showing a confirmation dialog:
osascript -e 'tell app "System Events" to restart'
Restart after showing a confirmation dialog:
osascript -e 'tell app "loginwindow" to «event aevtrrst»'
Log out without showing a confirmation dialog:
osascript -e 'tell app "System Events" to «event aevtrlgo»'
Log out after showing a confirmation dialog:
osascript -e 'tell app "System Events" to log out'
Go to sleep (AppleScript):
osascript -e 'tell app "System Events" to sleep'
CB
On 3/30/15 6:13 AM, Jürgen Fleger wrote:
Hi,
could anyone support me in creating an apple script? It is supposed to shut
down the Mac but playing a little sound before. So the stepps could be
1. Play sound x in folder y.
2. Wait as long as it takes to play the sound, maybe 3 seconds.
3. Press CMD + Option + CTRL + Eject. That’s the hotkey to shut down the Mac.
Would be great if anyone could help me to realize this. I’m able to read but
not create them.
All the best
Jürgen
--
¯\_(ツ)_/¯
--
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to macvisionaries+unsubscr...@googlegroups.com.
To post to this group, send email to macvisionaries@googlegroups.com.
Visit this group at http://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/d/optout.