4
votes

Previously, this could be done with an Applescript on Mountain Lion. This is because it targets System Preferences to adjust the brightness. System Preferences no longer has this setting in OSX 10.9 Mavericks. Any guidance on this issue would be appreciated. Thanks.brightness external display

Correction, my projector is plugged in all of the time so when the script is run, it jumps to the "projector" pane instead of the "built-in display" pane where the slider is located. I was thinking something like this would target the "Built-in Display" pane that has the slider. I can't seem to get it to work though.

    tell application "System Preferences"
        reveal anchor "displaysDisplayTab" of pane id         "com.apple.preference.displays"
        tell application "System Events" to tell process "System Preferences" to         tell window "Built-in Retina Display"
            delay 1
            set value of slider 1 of group 1 of tab group 1 of window 1 of         process "System Preferences" to 0

        end tell
        quit
    end tell
3

3 Answers

4
votes

It is still there?.

enter image description here

The old Applescripts I found will not work any more.

One example

tell application "System Preferences" 
    activate 
    set current pane to pane "com.apple.preference.displays" 
    tell application "System Events" 
        delay 1 
        set value of slider 1 of group 2 of tab group 1 of window 1 of process "System Preferences" to 0.5 
        delay 1 
    end tell 
    quit 
end tell

There is no group 2 of tab group 1 of window 1 of process "System

A simple fix change it to :group 1 of tab group 1 of window 1 of process "System

Working on Macbook 10.9:

tell application "System Preferences"
    activate
    reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
    tell application "System Events"
        delay 1
        set value of slider 1 of group 1 of tab group 1 of window 1 of process "System Preferences" to 0.5

    end tell
    quit
end tell

Update*

You can use the name of your window: "Built-in Display" Change the line:

set value of slider 1 of group 1 of tab group 1 of window 1 of process "System Preferences" to 0.5

to

set value of slider 1 of group 1 of tab group 1 of window "Built-in Display" of process "System Preferences" to 0.5
5
votes

You might also use brightness.c:

brightness 1 # set the brightness to the maximum on all displays
brightness -d 0 0.5 # set the brightness to 50% on the first display

If others search for how to put displays to sleep, you can use pmset displaysleepnow in 10.9 and later:

do shell script "pmset displaysleepnow"
1
votes

in case someone is still looking for help on this issue. It is possible to adjust BOTH the display of a MacBook Pro and the thunderbolt display from the same keyboard. For the MacBook Display you use the well known 2 keys with a small and a big sun symbol - on my MacBook Pro these are F1 and F2 . For the thunderbolt display you can use those keys too provided you also press ctrl + cmd. By the way when you press F1 and F2 together with alt-key the system control for monitors show up