Jump to content

how to use autoit to check keyboard type?


 Share

Recommended Posts

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!

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • 5 years later...
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
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...