I use several different keyboards and I wanted an easy way to switch to a specific keyboard (which is a functionality that is supposed to be in Windows 10, but I didn't get it to work from the official options). Anyway, I wrote the following script and it mostly works. My default keyboard is the English one (1), and the switching seems to work, except when I want to switch back to English: it does look like the language is English, but if I start writing, the writing comes out in Persian (not really desirable especially if trying to write an internet address...). Can anyone see what I'm doing wrong? Just to note: the English (international) - anna keyboard is based on the international US keyboard for windows 10, but I've added the macrons which are used in Maori. I've made it with the Microsoft Keyboard Layout Creator. Could that be an issue? I haven't seen any other weird functionality from it.
Code: Select all
^1::SetInputLang(0x0409) ; English (international) - anna
^2::SetInputLang(0x0419) ; Russian phonetic
^3::SetInputLang(0x0411) ; Japanese
^4::SetInputLang(0x0429) ; Persian
SetInputLang(Lang)
{
WinExist("A")
ControlGetFocus, CtrlInFocus
PostMessage, 0x50, 0, % Lang, %CtrlInFocus%
}
[Mod edit: [code][/code] tags added.]