Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I carry my Macbook Pro (15" Retina, Mid 2012 with Mt. Lion) between my work and home. It is connected to an external HDD as a Time Machine. I always forget to properly eject the HDD before putting my notebook to sleep (I rarely shut it down) at my office.

Is there a way to have it prompt with a custom reminder or warning when I try to put MBP to sleep, using Automator or something?

share|improve this question
1  
Do you put it to sleep by closing the lid? Using the keyboard shortcut? Selecting Sleep from the menu? –  Daniel Lawson Aug 9 '12 at 16:05
    
I do it by going to the Apple menu. Closing the lid would not give me any chance to see the warning. –  Ki Kim Aug 9 '12 at 18:04
    
Right. That's why I asked. –  Daniel Lawson Aug 9 '12 at 18:16
add comment

2 Answers 2

up vote 1 down vote accepted

You can write an AppleScript to do this, then instead of picking sleep from the  menu, you can select your script from the Script menu.

All of this can be set up from within AppleScript Editor:

  • Launch AppleScript Editor

  • Open Preferences

  • Check the box to "Show Script menu in menu bar". enter image description here

  • Create a new script

  • Here is the content of the script:

    display dialog "Are you sure you want to put the computer to sleep?"
    do shell script "pmset sleepnow"
    
  • Save the script as ~/Library/Scripts/Applications/AppleScript Editor/Sleep.scpt

Now you can put your computer to sleep from the script menu and be warned before sleeping.

share|improve this answer
    
Thanks, that's pretty much what I was looking for. Will try at the end of the day. –  Ki Kim Aug 9 '12 at 21:13
add comment

You could have the drive automatically ejected when you sleep the mac instead?

Quick search found Jettison on the Mac App Store http://itunes.apple.com/us/app/jettison/id447430809?mt=12

There is also an app you can use to run Apple script on sleep/wake: http://www.lagentesoft.com/scenario/index.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.