How can i change the layout of the keyboard denpending on the active window?
Thanks.
how to change the keyboard layout
Started by
mp
, Jun 10 2010 01:04 PM
6 replies to this topic
#1
-
Posted 10 June 2010 - 01:04 PM
thanks.Sure can. Check #IfWinActive
And which property/variable I should change. I didn't find any useful information in the documentation.
I'd like to avoid sending a key combination to change the layout. I would like something like this
IfWinActive windowName
keyboardLayout = international
#3
-
Posted 10 June 2010 - 01:45 PM
#IfWinActive, WindowName ;this is where the name of the window in question goes a::b s::d q::o ; these are just examples, map the keyboard however you like using this technique #IfWinActive ; this line makes it so the keyboard remap is only valid in the window you first specified
Something like this?
#4
-
Posted 10 June 2010 - 02:04 PM
You need to use shift+alt in your targeted window for change the keyboard layout... (default keys for Win OS)
<!-- m -->http://msdn.microsof...y/ms645530.aspx<!-- m -->
for change with a custom key
for your string comparaison
<!-- m -->http://msdn.microsof...y/ms645530.aspx<!-- m -->
for change with a custom key
!k::
send {shift down}{alt down}{shift up}{alt up}
; sleep can be usefull
hKbdL := DllCall("GetKeyboardLayout", "UInt", DllCall("GetWindowThreadProcessId", "UInt", WinExist("A"), "UInt", 0))
;SetFormat, IntegerFast, H
; get language name with string comparaison and hexadecimal
tooltip % hKbdl
;SetFormat, IntegerFast, D
returnfor your string comparaison
keylang=
(
0x02 DEFAULT
0x7F INVARIANT
0x00 NEUTRAL
0x36 AFRIKAANS
0x1c ALBANIAN
0x84 ALSATIAN
0x5E AMHARIC
0x01 ARABIC
0x2B ARMENIAN
0x4D ASSAMESE
0x2C AZERI
0x6D BASHKIR
0x2d BASQUE
0x23 BELARUSIAN
0x45 BENGALI
0x1A BOSNIAN
0x7E BRETON
0x02 BULGARIAN
0x03 CATALAN
0x04 CHINESE
0x83 CORSICAN
0x1A CROATIAN
0x05 CZECH
0x06 DANISH
0x8C DARI
0x65 DIVEHI
0x13 DUTCH
0x09 ENGLISH
0x25 ESTONIAN
0x38 FAEROESE
0x29 FARSI
0x64 FILIPINO
0x0B FINNISH
0x0C FRENCH
0x62 FRISIAN
0x56 GALICIAN
0x37 GEORGIAN
0x07 GERMAN
0x08 GREEK
0x6F GREENLANDIC
0x47 GUJARATI
0x68 HAUSA
0x0D HEBREW
0x39 HINDI
0x0E HUNGARIAN
0x0F ICELANDIC
0x70 IGBO
0x21 INDONESIAN
0x5D INUKTITUT
0x3C IRISH
0x10 ITALIAN
0x11 JAPANESE
0x4B KANNADA
0x60 KASHMIRI
0x3F KAZAK
0x53 KHMER
0x86 KICHE
0x87 KINYARWANDA
0x57 KONKANI
0x12 KOREAN
0x40 KYRGYZ
0x54 LAO
0x26 LATVIAN
0x27 LITHUANIAN
0x2E LOWER SORBIAN
0x6E LUXEMBOURGISH
0x2F MACEDONIAN
0x3E MALAY
0x4C MALAYALAM
0x3A MALTESE
0x58 MANIPURI
0x81 MAORI
0x7A MAPUDUNGUN
0x4E MARATHI
0x7C MOHAWK
0x50 MONGOLIAN
0x61 NEPALI
0x14 NORWEGIAN
0x82 OCCITAN
0x48 ORIYA
0x63 PASHTO
0x15 POLISH
0x16 PORTUGUESE
0x46 PUNJABI
0x6B QUECHUA
0x18 ROMANIAN
0x17 ROMANSH
0x19 RUSSIAN
0x3B SAMI
0x4F SANSKRIT
0x1a SERBIAN
0x6C SOTHO
0x32 TSWANA
0x59 SINDHI
0x5B SINHALESE
0x1b SLOVAK
0x24 SLOVENIAN
0x0A SPANISH
0x41 SWAHILI
0x1D SWEDISH
0x5A SYRIAC
0x28 TAJIK
0x5F TAMAZIGHT
0x49 TAMIL
0x44 TATAR
0x4A TELUGU
0x1E THAI
0x51 TIBETAN
0x73 TIGRIGNA
0x1F TURKISH
0x42 TURKMEN
0x22 UKRAINIAN
0x2E UPPER SORBIAN
0x20 URDU
0x80 UIGHUR
0x43 UZBEK
0x2A VIETNAMESE
0x52 WELSH
0x88 WOLOF
0x34 XHOSA
0x85 YAKUT
0x78 YI
0x6A YORUBA
0x35 ZULU
)
SetFormat, IntegerFast, Hex
varsetcapacity(lang, 8, 0)
DllCall("GetKeyboardLayoutName", "Str", lang)
If pos:=InStr(keylang, "0x" SubStr(lang, 7) " ")
msgbox % lang "`n"SubStr(keylang, pos, InStr(keylang, "`n", "", pos)-pos)
#5
-
Posted 10 June 2010 - 04:53 PM
Of course, if you don't want to use shift + alt , then use LoadKeyboardLayout() function in a hotkey
<!-- m -->http://msdn.microsof...y/ms646305.aspx<!-- m -->
However it's not a switch but for load a specific language, and this language must be already installed on your computer, and search in the forum I already view example for cyrilic keyboard...
<!-- m -->http://msdn.microsof...y/ms646305.aspx<!-- m -->
However it's not a switch but for load a specific language, and this language must be already installed on your computer, and search in the forum I already view example for cyrilic keyboard...
#6
-
Posted 10 June 2010 - 06:24 PM



Sign In
Create Account
Last active:
Back to top
