• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swap keyboard from "belgium" layout to US
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swap keyboard from "belgium" layout to US


  • Subject: Re: Swap keyboard from "belgium" layout to US
  • From: kai <email@hidden>
  • Date: Wed, 19 Apr 2006 03:21:50 +0100


On 18 Apr 2006, at 14:24, Jan Bultereys wrote:

Does anyone have an idea how to swap keyboard language in panther.
I want to swap the keyboard from “Belgian” to “US” and then back to “Belgian” via applescript or terminal command.

This seems to be another case where modifying the plist file (~/ Library/Preferences/com.apple.HIToolbox.plist) doesn't have any (desired) effect, Jan. Don't know if you're open to GUI scripting on this, but here's a stab at it, anyway. It relies, of course, on the input menu being available in the menu bar - and on the required layout[s] being present in the menu. While it works in Tiger, I can't say if it will in Panther. (Sometimes, adding a delay here and there seems to help with a pre-Tiger UI).


------------------

on switch_keyboard to keyboard_layout
tell application "System Events" to tell menu bar 1 of application process "SystemUIServer"
repeat with this_menu in menu bar items (* workaround for bug in conditional filter *)
tell this_menu to if value of attribute "AXDescription" is "text input menu extra" then
click (* open menu *)
tell menu item keyboard_layout of menu 1 to if exists then return click
cancel (* operation failed: close menu *)
exit repeat
end if
end repeat
end tell
beep (* indicate that a failure occurred *)
error number -128 (* cancel script execution *)
end switch_keyboard


switch_keyboard to "U.S."
delay 2 (* demo only: do some stuff *)
switch_keyboard to "Belgian"

------------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Swap keyboard from "belgium" layout to US
      • From: "Gary (Lists)" <email@hidden>
References: 
 >Swap keyboard from "belgium" layout to US (From: Jan Bultereys <email@hidden>)

  • Prev by Date: Check FTP file
  • Next by Date: Re: Check FTP file
  • Previous by thread: Swap keyboard from "belgium" layout to US
  • Next by thread: Re: Swap keyboard from "belgium" layout to US
  • Index(es):
    • Date
    • Thread