• 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
Switching Language Inputs in a Flash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Switching Language Inputs in a Flash


  • Subject: Switching Language Inputs in a Flash
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 28 Sep 2015 05:36:32 -0500

Hey Folks,

Okay, our discussion a while back prompted Shane Stanley to add language-input-switching to his BridgePlus ASObjC-library.

It's now out of beta:

BridgePlus Script Library v1.2.0
  http://macosxautomation.com/applescript/apps/BridgePlus.html
  http://macosxautomation.com/applescript/apps/BridgePlus_stuff.zip

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

Installation:

~/Library/Script Libraries/BridgePlus.scptd

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

Usage:


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

use framework "Foundation"
use script "BridgePlus"
load framework

set availableInputSources to (current application's SMSForder's availableInputSourceIDs()) as list
set allAvailableInputSources to (current application's SMSForder's allAvailableInputSourceIDs()) as list

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

set langSwitchResult to current application's SMSForder's changeInputSourceTo:"com.apple.keylayout.French"
delay 0.1
set langSwitchResult to current application's SMSForder's changeInputSourceTo:"com.apple.keylayout.Russian"
delay 0.1
set langSwitchResult to current application's SMSForder's changeInputSourceTo:"com.apple.keylayout.US"

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

langSwitchResult will return true or false depending upon success or failure.

There are some other useful features in that baby too — such as regex match and replace.

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

use framework "Foundation"
use bpLib : script "BridgePlus"
load framework

set l to {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"}
set sortedList to bpLib's sortListOfStrings:l caseSensitive:false

set _str to "Now is the time for all good men to come to the aid of their country."
set newStr to bpLib's regexReplace:"\\bmen\\b" withThis:"women" inString:_str

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

Not bad for a 365KB library.

--
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

  • Follow-Ups:
    • Re: Switching Language Inputs in a Flash
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Another darn problem that's beyond me.
  • Next by Date: Re: Switching Language Inputs in a Flash
  • Previous by thread: Re: Another darn problem that's beyond me.
  • Next by thread: Re: Switching Language Inputs in a Flash
  • Index(es):
    • Date
    • Thread