Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for an Applescript to dim/up 0%/100% screen brightness on OSX 10.9 Mavericks when connected to external display?

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
like image 668
Elias Avatar asked Dec 20 '22 20:12

Elias


1 Answers

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"
like image 146
Lri Avatar answered May 14 '23 07:05

Lri