Disable backlight keyboard automatically?

Discussion in 'MacBook Pro' started by REBELinBLUE, Dec 7, 2008.

  1. REBELinBLUE macrumors regular

    Joined:
    Oct 2, 2007
    Location:
    London, UK
    #1
    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.
     
  2. ergdegdeg Moderator emeritus

    ergdegdeg

    Joined:
    Oct 13, 2007
    #2
    Another perfect situation for Marco Polo. You can choose to use an Apple Script to disable the keyboard lighting when an external keyboard is attached.
     
  3. REBELinBLUE thread starter macrumors regular

    Joined:
    Oct 2, 2007
    Location:
    London, UK
    #3
    Oh thanks. I was playing around with that app yesterday for something else but that didn't even come to mind. Will play around with it again.
     
  4. REBELinBLUE thread starter macrumors regular

    Joined:
    Oct 2, 2007
    Location:
    London, UK
  5. ergdegdeg Moderator emeritus

    ergdegdeg

    Joined:
    Oct 13, 2007
    #5
    Set up a new USB rule (if you're using a wired keyboard) and give it a 100% confidence, when your keyboard is connected. The context would be "with keyboard" or whatever you name it. Then add an action to run an applescript when the context changes to "with keyboard". As for the applescript, you might want to google around.
     
  6. REBELinBLUE thread starter macrumors regular

    Joined:
    Oct 2, 2007
    Location:
    London, UK
    #6
    Yeah I knew how to use Marco Polo, it was the AppleScript I couldn't figure out

    anyway I figured it out with some playing around, it is not pretty and I'm sure there is a better way to do it

    Code:
    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
    Saved as disable and then changing "is 1 then" to "is 0 then" as the enable script.

    Thanks for your help
     

Share This Page