My AppleScript works when I am just using my MacBook Pro Retina, however if i have my Thunderbolt Display attached the script does not work.

Here is the script which works perfectly on just the laptop:

######## turn screen bright
repeat 25 times
    tell application "System Events"
        key code 113
    end tell
end repeat

Terminal will display this if i am running on the Thunderbolt Display:

^[[28~^[[28~^{{ (repeats)

Does any one know the key code to adjust brightness on the Thunderbolt Display or where I may find it?

Thanks in advance

  • What version of Mac OS X are you using? Are you using this with the MBP closed or open?
    – tubedogg
    Aug 19 '13 at 21:28
  • Im using 10.8.4 and i have the MBP open with it being its own display. the script does not effect either of the monitors when the display is plugged in. thanks in advance
    – KTAISA
    Aug 19 '13 at 21:33

Did you try key code 113 using control down? Pressing the brightness keys while holding control normally changes the brightness of a Thunderbolt Display, but I don't know if it works with keys like F15.

You can also use brightness.c to change the brightness of different displays:

do shell script "~/bin/brightness -d 1 0.0"
  • 1
    Using the brightness.c was something i have not thought of and probably makes more sense than a loop of system event key codes - thanks
    – KTAISA
    Aug 20 '13 at 15:28

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .