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.

Basically, whenever I know I'm going to be gone, or if I'm going to sleep, I change the Energy Saver settings in System Preferences in OS X (10.7.3) for Power Adapter to:

  • Computer sleep: 1 min
  • Display sleep: 1 min

If I know I'm going to be around a while, I like to change the Energy Saver settings for Power Adapter to:

  • Computer Sleep: 15 min
  • Display Sleep: 15 min

Is it possible to script this sort of change? I do it often enough that a script would be worth it.

share|improve this question
    
Couldn't you just put the computer (⌥⌘⏏) or display (⌃⇧⏏) to sleep manually? –  Lri Mar 2 '12 at 2:55
    
@Lri: That also works for me. If you put that down as an answer, I'd upvote it. Is there any way to put both to sleep simultaneously? –  Geoff Oxberry Mar 3 '12 at 7:26
    
Normal sleep should put displays to sleep as well. (If it doesn't on your Mac, you could probably make another question about it.) –  Lri Mar 3 '12 at 9:03

1 Answer 1

up vote 3 down vote accepted

Look for the section titled "Changing Power Management Settings" in this MacScripter guide. An AppleScript example from the guide:

do shell script "pmset sleep 30" with administrator privileges
share|improve this answer
1  
You can also change the display sleep and store the login password in the script: do shell script "pmset displaysleep 30" password "somepassword" with administrator privileges –  Lri Mar 2 '12 at 2:53

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.