Hey RuslanI,
The word remap would tend to suggest that I'm doing something with the keyboard, but in this case I'm really just doing a character-level find/replace on a string and pasting it back in.
Yes. Unfortunately that is low level stuff:
From a friend of mine who's an ASObjC Guru:
“You can't do that from ASObjC -- it's a C-based Carbon API. Very few functions involving CF (Core Foundation) references are accessible for ASObjC.”
So this can't be done with the shell or with plain AppleScript or with AppleScript-Objective-C.
However.
I got him to add a programming method to his BridgePlus ASObjC-Library to make this accessible to AppleScript.
The script to change input-methods looks like this:
use framework "Foundation"
use script "BridgePlus"
load framework
set langSwitchResult to current application's SMSForder's changeInputSourceTo:"com.apple.keylayout.Russian"
HOWEVER – the above script will not work unless the BridgePlus ASObjC library is installed on your system.
AND the current release version does not contain the feature.
It's in beta right now, although I think Shane will release it very soon. (I've asked him when it will go final but haven't heard back yet.)
So – in summation:
It will shortly be possible to smoothly and seamlessly switch language inputs using AppleScript.
I will post here when the new version of BridgePlus is available and will also provide a working sample macro.
-Chris