1

Prior to Big Sur I used scripts to toggle the sleep function on my MacBook, for example:

tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.energysaver"
end tell

tell application "System Events"
    tell application process "System Preferences"
        repeat until exists tab group 1 of window "Energy Saver"
        end repeat
        tell tab group 1 of window "Energy Saver"
            click radio button "Power Adapter"
            tell checkbox 1 to if value is 1 then click
        end tell
    end tell
end tell

delay 2
tell application "System Preferences" to quit

Obviously, the pane is now called com.apple.preference.battery, but I'm not sure how to navigate the new "buttons" on the left side.

->g.

You must log in to answer this question.

Browse other questions tagged .