Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

robot62155

macrumors member
Original poster
Jun 5, 2011
32
0
Hi everyone. This is my first post! I recently got a Macbook Pro, and I have been scripting some stuff on AppleScript. I tried to script something that would automatically turn off the keyboard lights for me. Can anyone tell me what is wrong with this? Thanks in advance! ;)


say "Do you want the keyboard lights off?"
display dialog "Do you want the keyboard lights off?" buttons {"yes", "no"}

set button_r to the button returned of the result

if the button_r is "yes" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
end if
tell application "System Events"
tell application process "system preferences"
click checkbox "Illuminate keyboard in low light conditions" of group 2 of tab group 2 of window "Keyboard"
end tell
end tell

if the button_r is "no" then
end if
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.