I dont know if this is the best place to start for a Script Noobie but here go, I am running Two keyboards one is a English (primary) and the other French both are Bluetoooth so each has its own Device ID what I would like to do is set up a script that sense’s which keyboard is pressed and switches to the appropriate input language as Cmd Space means I have to look up to check the current language and clicking the flag is a pain when shifting for a couple of special French Characters. Is this in the realms of possible.? Im new to scripting but dont mind putting the time in to learn as I suspect it will help me understand how these machines work.
Cheers
Ka
Model: Mac Pro, MBP, iMac
Browser: Firefox 2.0.0.16
Operating System: Mac OS X (10.5)
Welcome. I hope someone will be able to help, but most of us don’t have two keyboards to try this on.
This script will tell you your keyboard layout name:
set myPrefs to POSIX path of (path to preferences folder from user domain as text)
set MAC to primary Ethernet address of (get system info)
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set MAC to (text items of MAC)
set AppleScript's text item delimiters to tid
set MAC to MAC as text
set L to paragraph -2 of (do shell script "defaults read " & myPrefs & "ByHost/com.apple.HIToolbox." & MAC & " | grep -A 4 AppleCurrentAsciiInputSource")
Either way requires some method to fire the script. The bluetooth API is where you will need to start and since you will need to verse yourself in Obj-C I would suggest using that method as well to change the input.