Actualización: Este script actualizado no parpadea por la pantalla, es decir, se ejecuta en el backgound. La versión antigua sigue siendo válida.
tell application "System Events"
tell process "System Preferences"
activate
end tell
tell application "System Preferences"
set current pane to pane "com.apple.preference.energysaver"
end tell
tell process "System Preferences"
click checkbox 1 of window 1
end tell
tell application "System Preferences"
quit
end tell
end tell
Desde el 18 de octubre:
-- Allow Script Editor in Accessibility <- Privacy <- Security & Privacy <- System Preferences. For testing, at the very least.
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.energysaver"
end tell
tell application "System Events"
tell process "System Preferences"
tell window 1
click checkbox 1
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
-- Create an Automator Service with this, so that you can bind the action to a keyboard shortcut.