Currently Being ModeratedMay 3, 2012 8:37 AM (in response to Thierry Leveque)
Provided the Input menu is already showing in the menu bar and contains the desired input source, the following script shoud do what you are asking for:
set theInputSource to "Canadian French - CSA"
tell application "System Events" to tell process "SystemUIServer"
click (menu bar item 1 of menu bar 1 whose description is "text input")
click menu item theInputSource of menu 1 of result
Since the above script uses GUI Scripting, you must enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.
Message was edited by: Pierre L.