applescript (?) question

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

  1. Am3822 macrumors 6502

    Am3822

    Joined:
    Aug 16, 2006
    Location:
    Groningen, The Netherlands
    #1
    Hi all,

    I have an annoying problem with X11.app (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

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #2
    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

    Code:
    try
    	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
    					click
    					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
    --END OF SCRIPT
    
     

Share This Page