Changing Windows language programatically

0

1

I have multiple input languages in my Windows XP: English and Hebrew. I use both of them.

I want to make a script that will programmatically switch to English. (If that's hard to do, a workaround might be to programatically press Alt-Shift, if that's possible.)

Does anyone know how to do that?

Ram Rachum

Posted 2010-12-25T18:23:37.967

Reputation: 4 261

Answers

1

I wasn't able to find any correct programmatic way of doing this, but it's pretty easy to fake out pressing a key. Here is a PowerShell script that does that:

[System.Reflection.Assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[System.Windows.Forms.SendKeys]::SendWait("%+")

EDIT:

I found out a better way to do this programmatically, essentially using the LoadKeyboardLayout and ActivateKeyboardLayout functions. I'll admit, it isn't very easy to script.

vcsjones

Posted 2010-12-25T18:23:37.967

Reputation: 2 433