How to change keyboard language layout?
-
- Posts: 1
- Joined: 25 Jun 2016, 03:01
How to change keyboard language layout?
Hi,
I am a newbie in .AHK.
Can someone help?
I need a script that makes a shortcut to change keyboard layout, for ex. from ENG to SLK or so.
From default ALT + Shift to something else, for ex. LCTRL + LSHIFT and RCTRL + RSHIFT.
I would appreciate any help!
Thanks.
I am a newbie in .AHK.
Can someone help?
I need a script that makes a shortcut to change keyboard layout, for ex. from ENG to SLK or so.
From default ALT + Shift to something else, for ex. LCTRL + LSHIFT and RCTRL + RSHIFT.
I would appreciate any help!
Thanks.
Re: How to change keyboard language layout?
Try this Default Keyboard Lang.
Please excuse my spelling I am dyslexic.
Re: How to change keyboard language layout?
For many years, I have used the plain Capslock to change language with no problems. The key is handy and useless! Besides, if you ever need to Capslock, use the key with Shift.
Code: Select all
Capslock::
Send, {Alt Down}{Shift Down}{Shift Up}{Alt Up}
SoundBeep 999, 1
return
Re: How to change keyboard language layout?
thank you Capn Odin , some links
EDIT : added function
;- in WINDOWS-10 maybe use key WIN+SPACE
;----------------------------------------------------------
; https://autohotkey.com/docs/misc/Languages.htm ---
; http://www.science.co.il/language/locale-codes.asp
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
;--------------------------------------------------------------------
EDIT : added function
;- in WINDOWS-10 maybe use key WIN+SPACE
;----------------------------------------------------------
; https://autohotkey.com/docs/misc/Languages.htm ---
; http://www.science.co.il/language/locale-codes.asp
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
;--------------------------------------------------------------------
Code: Select all
;- toggle F4 > russian or english-US
$F4::
V++
M:=mod(V,2)
if M=1
SetDefaultKeyboard(0x0419) ; Russian
else
SetDefaultKeyboard(0x0409) ; english-US
return
SetDefaultKeyboard(LocaleID){
Global
SPI_SETDEFAULTINPUTLANG := 0x005A
SPIF_SENDWININICHANGE := 2
Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0)
VarSetCapacity(Lan%LocaleID%, 4, 0)
NumPut(LocaleID, Lan%LocaleID%)
DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &Lan%LocaleID%, "UInt", SPIF_SENDWININICHANGE)
WinGet, windows, List
Loop %windows% {
PostMessage 0x50, 0, %Lan%, , % "ahk_id " windows%A_Index%
}
}
return
Last edited by garry on 16 Sep 2018, 05:23, edited 1 time in total.
Re: How to change keyboard language layout?
FYI:
Alt+Shift switches between keyboard layouts
Ctrl+Shift is already default to switch keyboard languages within a layout
This all depends on how you've set it up.
And you can set specific shortcuts directly in windows.
Alt+Shift switches between keyboard layouts
Ctrl+Shift is already default to switch keyboard languages within a layout
This all depends on how you've set it up.
And you can set specific shortcuts directly in windows.
Spoiler
-
- Posts: 29
- Joined: 09 Aug 2018, 11:24
Re: How to change keyboard language layout?
Guys, have you tried to open (Win+S or Win+A) then switch language? For me it's not working. Maybe we can correct the scripts in order to make it work?
Re: How to change keyboard language layout?
Hi, I get this error:garry wrote:thank you Capn Odin , some links
;- in WINDOWS-10 maybe use key WIN+SPACE
;----------------------------------------------------------
; https://autohotkey.com/docs/misc/Languages.htm ---
; http://www.science.co.il/language/locale-codes.asp
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
; https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
;--------------------------------------------------------------------Code: Select all
;- toggle F4 > russian or english-US $F4:: V++ M:=mod(V,2) if M=1 SetDefaultKeyboard(0x0419) ; Russian else SetDefaultKeyboard(0x0409) ; english-US return
Call to nonexistent function
Please help!
Re: How to change keyboard language layout?
sorry , missing function
2nd example :
Code: Select all
;- toggle F4 > swiss-german or english-US
$F4::
V++
M:=mod(V,2)
if M=1
{
SetDefaultKeyboard(0x0807) ;- swiss german
;SetDefaultKeyboard(0x0419) ; Russian
}
else
SetDefaultKeyboard(0x0409) ; english-US
return
SetDefaultKeyboard(LocaleID){
Global
SPI_SETDEFAULTINPUTLANG := 0x005A
SPIF_SENDWININICHANGE := 2
Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0)
VarSetCapacity(Lan%LocaleID%, 4, 0)
NumPut(LocaleID, Lan%LocaleID%)
DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &Lan%LocaleID%, "UInt", SPIF_SENDWININICHANGE)
WinGet, windows, List
Loop %windows% {
PostMessage 0x50, 0, %Lan%, , % "ahk_id " windows%A_Index%
}
}
return
Code: Select all
;- keyboardx Capn Odin
;https://autohotkey.com/boards/viewtopic.php?f=6&t=18519
^0::SetDefaultKeyboard(0x0807) ; swiss-german
^1::SetDefaultKeyboard(0x0406) ; Danish
^2::SetDefaultKeyboard(0x0409) ; English (USA)
^3::SetDefaultKeyboard(0x0411) ; Japanese
^4::SetDefaultKeyboard(0x0408) ; Greek
return
SetDefaultKeyboard(LocaleID){
Global
SPI_SETDEFAULTINPUTLANG := 0x005A
SPIF_SENDWININICHANGE := 2
Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0)
VarSetCapacity(Lan%LocaleID%, 4, 0)
NumPut(LocaleID, Lan%LocaleID%)
DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &Lan%LocaleID%, "UInt", SPIF_SENDWININICHANGE)
WinGet, windows, List
Loop %windows% {
PostMessage 0x50, 0, %Lan%, , % "ahk_id " windows%A_Index%
}
}
return
Re: How to change keyboard language layout?
Hello, i desperately need the same script for AutoHotkey v2.garry wrote: ↑13 Feb 2017, 17:35Code: Select all
;- toggle F4 > russian or english-US $F4:: V++ M:=mod(V,2) if M=1 SetDefaultKeyboard(0x0419) ; Russian else SetDefaultKeyboard(0x0409) ; english-US return SetDefaultKeyboard(LocaleID){ Global SPI_SETDEFAULTINPUTLANG := 0x005A SPIF_SENDWININICHANGE := 2 Lan := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0) VarSetCapacity(Lan%LocaleID%, 4, 0) NumPut(LocaleID, Lan%LocaleID%) DllCall("SystemParametersInfo", "UInt", SPI_SETDEFAULTINPUTLANG, "UInt", 0, "UPtr", &Lan%LocaleID%, "UInt", SPIF_SENDWININICHANGE) WinGet, windows, List Loop %windows% { PostMessage 0x50, 0, %Lan%, , % "ahk_id " windows%A_Index% } } return
Ideally that would assign Ctrl+Shift to change the input language.
(yes, i know it can be assigned in Windows settings)