Jump to content

Recommended Posts

Posted

Sorry but Im newbie at autoit, so I dont know how to do this.

I often type in two languages: English and Vietnamese. And I use Unikey to switch 2 languages above (by hot key CTRL + SHIFT). 

Now I want to check: If in Vietnamese, It will change to English automaticaly (or vice versa)

Could anyone help me to do this!

Thanks!

  • Moderators
Posted

No one will just write the code for you, this is a teach to fish type forum.

Area's you'll want to look in the help file:

_WinAPI_GetDesktopWindow

_WinAPI_GetKeyboardLayout

_WinAPI_LoadKeyboardLayout

To help you understand and get started:

#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <APILocaleConstants.au3>
#include <WinAPILocale.au3>
Local $hWnd = _WinAPI_GetDesktopWindow()
Local $iLocale = _WinAPI_GetKeyboardLayout($hWnd)
$iLocale = _WinAPI_LoWord($iLocale)
Local $sLocale = _WinAPI_GetLocaleInfo($iLocale, $LOCALE_SLANGUAGE)
MsgBox(64, "Info", "Current language layout: " & $sLocale)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

I dont know why but I think Unikey dont affect the input language. Because when I use Unkey in the English mode or Vietnamese mode, the input language dont change (It always show EN in the language bar)

  • 5 years later...
Posted (edited)
On 12/6/2014 at 12:40 PM, SmOke_N said:

To help you understand and get started:

#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <APILocaleConstants.au3>
#include <WinAPILocale.au3>
Local $hWnd = _WinAPI_GetDesktopWindow()
Local $iLocale = _WinAPI_GetKeyboardLayout($hWnd)
$iLocale = _WinAPI_LoWord($iLocale)
Local $sLocale = _WinAPI_GetLocaleInfo($iLocale, $LOCALE_SLANGUAGE)
MsgBox(64, "Info", "Current language layout: " & $sLocale)

To me this always brings the default input.

To get the current input, one can just use the following built-in command:

@KBLayout

 

Edited by LWC

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...