Does anyone know if it is possible to automatically disable the keyboard backlight on the new MBP when an external keyboard is attached? If so how do I achieve it. I'll looked around but couldn't find anything.
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
if UI elements enabled then
tell application process "System Preferences"
get properties
if value of checkbox "Illuminate keyboard in low light conditions" of group 1 of tab group 1 of window "Keyboard & Mouse" is 1 then
click checkbox "Illuminate keyboard in low light conditions" of group 1 of tab group 1 of window "Keyboard & Mouse"
end if
end tell
tell application "System Preferences" to quit
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell