applescript (?) question

Discussion in 'Mac Programming' started by Am3822, Jan 12, 2008.

  1. Am3822 macrumors 6502


    Aug 16, 2006
    Groningen, The Netherlands
    Hi all,

    I have an annoying problem with (and a few other applications). If I launch it while I'm using Hebrew keyboard layout, it's unusable unless the layout is changed from the menubar.

    Is there a way to write an applescript 'wrapper' that would change the keyboard layout selection to English and then launch an application?
  2. xUKHCx Administrator emeritus


    Jan 15, 2006
    The Kop
    Found this over at Apple Discussions (Hiroto) that seems to work on my computer. Obviously change British to whatever you want and iTunes.

    It is possible to modify it to watch form X11 to close and then revert back to hebrew

    	script o
    		tell application "System Events" to tell process "SystemUIServer"
    			set _ to get value of attribute "AXDescription" of every menu bar item of menu bar 1
    			set {k, j} to {count of _, 0}
    			repeat with i from 1 to k
    				if _'s item i is "text input" then
    					set j to i
    					exit repeat
    				end if
    			end repeat
    			if j > 0 then
    				tell menu bar item j of menu bar 1
    					tell menu 1
    						click menu item "British"
    					end tell
    				end tell
    			end if -- j > 0
    		end tell -- to process and System Events
    		tell application "iTunes" to activate
    	end script
    on error
    	display dialog "An unexpected error"
    end try
    run script o

Share This Page