How to change the input language text input menu on Snow Leopard ?

I can’t seem to find a working solution for changing the input language on snow leopard.
Any suggestions how we can switch between e.g. English and Hebrew using AppleScript?

Check out this post. I wrote it awhile back when I was attempting to learn Hebrew.

Let me know if you need a compiled version.


An AppleScript solution, which works at least in Leopard


on changeInputLanguage(L)
	tell application "System Events" to tell process "SystemUIServer"
		tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" is "text input")
			return {its value, click, click menu 1's menu item L}
		end tell
	end tell
end changeInputLanguage

Thanks Stefan,

I updated my post to reflect this option as well.


Thanks, Craig, but the Obj-C version is indeed more sophisticated :wink:

I’d like a compiled version and/or steps on how to compile it myself, please. I use german and english as languages.

Hi Oliver,

I have updated my post to show the Terminal command required to compile the utility. I have also added a version, contributed by Stefan, that changes the input based on name. This is very useful if you want to check to see if an input is available or if you have several languages to switch between. Many thanks to Stefan for his contribution!



Thanks but this is not working at all, the explanation is a little confusing, too.
You wrote:

Shouldn’t it be ‘input’ without a dot?
Then I tried to use Stefan’s alternative but where does this go:


When I type the terminal command i get a “-bash: gcc: command not found”.
Thanks anyway.

You can download a compiled version here (minimum requirement 10.5)

put the executable anywhere and use it in Terminal app

/path/to/changeInput U.S.

or in AppleScript

do shell script "/path/to/changeInput U.S."

/path/to/changeInput is the full path to the executable. If there are space characters in the path, quote it or escape the spaces

You rock Stefan, works flawlessly. Thanks a ton! :slight_smile:


If I’d like to toggle two languages, say “German” and “U.S.”, how would the AppleScript part look like?

E.G. if current language is “German” then do shell script “/path/to/changeInput U.S.”,
if language is “U.S.” do shell script “/path/to/changeInput German”,
else do nothing.

Here is an extended version.
the syntax

do shell script "/path/to/changeInput toggle U.S. German"

toggles between the two arguments

Great Stefan, thx again. :wink:

No, the dot should not be in the name of the folder. That is the correct way to end a
sentence in English though. I will take it out on the post since it does cause confusion.


it is not like I haven’t tested it both ways but due to the lack of my knowledge I couldn’t get it to work anyway. Sorry if I came across a little harsh, it wasn’t my intention.

BTW, even though English isn’t my native tongue I was under the impression that a sentence always ends with a dot instead of a quotation mark. We always learn as it seems. :wink:

Hi Oliver,

I didn’t take your post as harsh at all. If what I wrote does not make sense, I benefit from knowing that. :slight_smile:
I apologize if I come across harsh in my post. That was not my intention.

I have never been that good with English so you are probably correct. Either way, it is confusing
when it comes to code so I will leave that off from now on. Also, Stefan has provided me with his
latest improvements so I am updating the post with it. His is a very nice and user friendly solution.

I will also post a binary for downloading and rewrite the terminal command to try and make it more
clear on what it is doing. A little more explanation should help.

Thank you for your input!



Hi Craig,

no worries. I owe you both. :wink:


I need to change the input to Chinese but all the input names have two words for example “Pinyin - Simplified”, “Wubi Xing”, “Wubi Hua”. How can I get this to work?

SOLVED: Ok, nevermind. This was a PHP thing. I needed to run Apache as a “User” (not WWW) to allow PHP run the shell command. This did the trick: system(‘/changeInput “Pinyin - Simplified”’);