Language in Menu Extra (plz help)

Hi everyone,

Thank you very much for starting reading my question. I don’t have a background of “scripting”, but I have learned how-to recently. Hope everyone can give me a hand :slight_smile: .

Because sometimes I have to use Chinese, I have two languages (English is primary/system-wide, Chinese is secondary). I believe there is a bug in Traditional Chinese; everything I choose to “Delete Hanzi”, it changes back to “Reduce PinYin” after restart/logout (“Delete Hanzi” & “Reduce PinYi” are in the same drop menu under Delete).

I attach a screenshot for better understanding: [b][/b]

So, I was working on the script which can run on the start to “refesh” to “Delete Hanzi” and then change back to English as primary before the script finishes. Well, no luck for several hours… I have following but it stuck :frowning: .

activate application "SystemUIServer"

tell application "System Events"
	tell process "SystemUIServer"
		set v to value of attribute "AXDescription" of menu bar items of menu bar 1
		repeat with i from (count v) to 1 by -1
			if item i of v is "text input menu extra" then exit repeat
		end repeat
		tell menu bar item i of menu bar 1
			delay 0.1
			click menu item "Hanin" of menu 1
			tell menu bar item i of menu bar 1
				delay 0.5
				click menu item "Preferences" of menu 1
			end tell
		end tell
	end tell
end tell

Hope someone can help me out. Sincerely appreciate!!

Model: MacBook
AppleScript: 2.1.1
Browser: Firefox
Operating System: Mac OS X (10.4)


I’m using this script to toggle the first two languages in System Preferences > International
Hope it helps

quit application "Finder"
tell (do shell script "defaults read NSGlobalDomain AppleLanguages") to set L2 to text 1 & text 6 thru 7 & ", " & text 2 thru 3 & text 8 thru -1
do shell script "defaults write NSGlobalDomain AppleLanguages " & quoted form of L2
delay 1
launch application "Finder"