Actualización: esta secuencia de comandos actualizada no se muestra en la pantalla, es decir, se ejecuta en el fondo. La versión anterior 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
A partir del 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.