10.4: Use Automator to control display sleep and muting
Jul 27, '06 07:30:03AM
Contributed by: Anonymous
There have been various tips on how to easily put the display of your Mac to sleep while keeping the hard disk awake and active. But none have really accomplished what I wanted to do, so I came up with my own solution.
Using Automator, I have created a workflow/app that will mute the computer, set the display to sleep after one minute of inactivity, and raise a pop-up menu, at which point you can do one of two things: either lock the settings into place, or turn off the program and reset the display sleep time and volume to your own specifications.
Launch Automator, and enter the following sequence of coammands...
- Click on the System Library entry, then drag (or double-click) the Set Computer Volume Action to the right-hand work area.
- Select the Automator Library, and drag the Run AppleScript Action into the work area. For the script, use this:
on run {input, parameters}
do shell script ("pmset displaysleep 1") password "qrwew" ¬
with administrator privileges
return input
end run
Change qrwew to your amin password.
- Drag the Ask for Confirmation Action (also in the Automator Library) to the work area. You can customize this pop-up box as you wish. For mine, I have Message set to Display Sleep, Cancel has been changed to Lock, and Go has been changed to Restore.
- Still in the Automator Library, drag the Run AppleScript Action into the work area, and enter this code:
on run {input, parameters}
do shell script ("pmset displaysleep 0") password "qrwew" ¬
with administrator privileges
return input
end run
Again, change qrwew to your admin password, and display sleep time to whatever you want (as is with 0, the display will not sleep).
- Back in the System Library, drag the Set Computer Volume action to the work area. Change it's setting to whatever you normally set your volume to.
When you're done, save the whole thing as an application. This works especially well with CornerClick, because you can set it to a corner, click there, and the program runs!
If you lock the settings in place and wish to change them back, simply run the program again and click Restore. Locking the settings into place is a great way to set your laptop up for class or work, so it is muted and saves battery by not running the screen all the time. And just leaving it running is great for running downloads overnight, and easily reverting to your normal settings in the morning!
[robg adds: I haven't tested this one...]
Comments (4)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060723173748167