AnuRV
AnuRV

Reputation: 35

scripting system preference display settings

How to set System Preferences-> Display -> Scaled -> More Space with the help of AppleScript?

I got till:

    tell application "System Events"
        tell process "System Preferences"
            set frontmost to true
            click button "Displays" of scroll area 1 of window "System Preferences"
            click radio button "Scaled" of radio group 1 of tab group 1 of window "Built-in Retina Display"

But not sure how to set the " More Space" option?

TIA

Upvotes: 2

Views: 915

Answers (2)

helmedeiros
helmedeiros

Reputation: 497

A small command line script to change screen resolutions on macOs Sierra

#!/usr/bin/osascript
tell application "System Preferences"
        reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
    end tell

    tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
        click radio button "Display" of first tab group
        click radio button "Scaled" of first radio group of first tab group
        tell first radio group of second group of first tab group
            set isDefault to get value of second radio button
        end tell
        if isDefault then
            click last radio button of first radio group of second group of first tab group
        else
            click second radio button of first radio group of second group of first tab group
        end if
    end tell

    tell application "System Preferences"
        quit
    end tell

Upvotes: 1

Shimi Bitton
Shimi Bitton

Reputation: 164

try this:

tell application "System Preferences"
     reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell


tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
    click radio button "Display" of tab group 1
    click radio button "Scaled" of radio group 1 of tab group 1
    click radio button 4 of radio group 1 of group 2 of tab group 1
end tell
quit application "System Preferences"

Upvotes: 1

Related Questions