• 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
Getting the Input Language with System Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the Input Language with System Events


  • Subject: Getting the Input Language with System Events
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 12 Sep 2015 22:43:01 -0500

Hey Folks,

Fooling with this for someone on a different list and thought I'd post it here too.

I expect this will take adjustment for non-English systems, but it's working reliably on my 10.10.5 system.

------------------------------------------------------------
# Get Input Source Language from menu bar input menu.
# Input menu icon must be visible in the menu bar.
------------------------------------------------------------
tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0
  tell application process "SystemUIServer"
    tell menu bar 1
      try
        set inputMenu to first menu bar item whose accessibility description is "text input"
      on error
        error "The Input Menu is probably not visible in the menu bar."
      end try
    end tell
  end tell

  

  tell inputMenu to set inputLocale to its value

  

end tell
------------------------------------------------------------

I don't know of another method that is completely reliable, but if someone else does I'm interested.

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Radio button in Acrobat not de-selecting.
  • Next by Date: This works in Applescript, but not ASObjC
  • Previous by thread: Re: Radio button in Acrobat not de-selecting.
  • Next by thread: Re: Getting the Input Language with System Events
  • Index(es):
    • Date
    • Thread