writing script for shutting it all down

Greetings! My wife has asked that I “make something” where she can just press one button and shut the whole Mac down. Applescript is the obvious solution. I did whip up the “tell application “System Events” shut down” thing. And it works in most instances.

But I also know her habits, and it is likely that she’ll have open apps with unsaved documents. I did a couple hours of searching here on MacScripter, and what I’ve come to understand, is there is no way to script actions that will save unsaved documents.

Is this true? Thanks in advance!


to shut down the mac there’s a shortcut, a script is not required.

⌃⌥⌘⏏ (control-option-command-eject)

Your wife should change her habits, because every user is responsible for his/her unsaved documents :wink:

HAHA! I know she should, Stefan, but I wield no power in that arena. :stuck_out_tongue:

On the other hand - if it’s true - I can tell her that the “save document” thing cannot be bypassed because that’s just how the system operates, and she’ll deal with it.

And by the way, the keystroke combination you listed is three more keys than she wants to press. :rolleyes:

In fact it’s one key pressed with four fingers :wink:

do shell script "shutdown -h now" password "¢¢¢¢¢" with administrator privileges

(“¢¢¢¢¢” is an admin password)
does the same like ⌃⌥⌘⏏, you need a third party tool like Butler, QuickSilber, QuicKeys or FastScripts to assign a (one key) shortcut to

Thanks again, Stefan. I’ll give it a try tonight when I’m home.