Hey all, I have this script that sets the EnergySaver settings, but after it sets the settings and closes the applications, the settings don’t stick. I open back up and they are back to what they were before. Any help appreciated. Thanks
tell application “System Events”
tell application “System Preferences”
activate
set current pane to pane “com.apple.preference.energysaver”
end tell
tell application “System Events” to tell process “System Preferences”
delay 1
tell slider 1 of group 1 of window 1 to set value to 250
delay 1
tell slider 2 of group 1 of window 1 to set value to 110
delay 5
end tell
quit application “System Preferences”
end tell
Model: iMac intel
AppleScript: 2.3
Browser: Chrome
Operating System: Mac OS X (10.6)
Are you sure the script is not erroring out? I keep getting an “Invalid Index” error.
Yes, its not erroring out. I can actually see the slider move (because of the delay) then it closes fine, but upon reopening they are not changed. Here it is again with spacing:
tell application "System Events"
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.energysaver"
end tell
tell application "System Events" to tell process "System Preferences"
delay 1
tell slider 1 of group 1 of window 1 to set value to 250
delay 1
tell slider 2 of group 1 of window 1 to set value to 110
delay 5
end tell
quit application "System Preferences"
end tell
Here I’ve created a screen capture showing the script and it’s actions:
http://www.youtube.com/watch?v=eQxxdcyfoFs
easier
do shell script "systemsetup -setcomputersleep 170 -setdisplaysleep 110"
Note: the numeric values must be in the range of 1 - 180. Specify Never or Off for never
EXCELLENT!! Thank you so much. That worked perfectly.
Often I’ll render a Blender render with LuxRender overnight and the next day I always set the sleep back to normal, so this will help.
Much appreciated.
This is slightly off-topic, but you mentioned Blender and your youtube account is under onjoMedia. Is that by any chance related to onjoFilms? (My small-world sense is tingling.)
Yep, you got it Mr. Vickers. How’s the animations going?
The world is indeed too small.
The animations are nearly at a stand-still, I’m afraid. Too busy with 17-hour days. The latest image I have from the temporarily shelved Plex and Scorch 5 is here: http://a1.sphotos.ak.fbcdn.net/hphotos-ak-snc4/164302_10150108537126042_747856041_7389401_2393431_n.jpg
I’m still trying to do some live action in my spare time. Check out http://www.youtube.com/epicmonkeyfries
And I’ll quit talking about youtube in an Applescript Forum now.
Drop me a private message if you like.
Rather than using the GUI interface, you could use the pmset terminal command. Typing man pmset will tell you all you need to know. I found out about this for dynamic startup timing…