Home windows Windows 10: How to exclude a language from Alt-Shift switching?

Windows 10: How to exclude a language from Alt-Shift switching?

Author

Date

Category

I have two languages ​​on Window 10: Russian and English. Accordingly, there are two keyboard layouts. I actively use both. Now I am studying another foreign language and to work with it I need a third layout. If you add this language to Windows, then it appears in the list of input languages ​​switched by Alt-Shift. But I need input in this language from time to time, and not on an ongoing basis. And on Alt-Shift it interferes with the fact that periodically you have to press Alt-Shift twice to switch from Russian to English, skipping this language.

Can you please tell me if there is a way to exclude some of the input languages ​​installed in the system from the range of languages ​​switched by Alt-Shift?

I not need to change the keyboard shortcut to switch languages. Alt-Shift gets me right. I need that with three languages ​​installed in the system, for example English, Russian and Chinese, switching by pressing Alt-Shift would be like this:

English – Russian – English – Russian ….

not like this:

English – Russian – Chinese – English – Russian – Chinese – …

In this case, Chinese must be available among the input languages. It can be selected either with the mouse through the language bar, or with a separate key combination. For example Ctrl-1.


Answer 1

I found exactly the same question at superuser.com . There are two solutions suggested. For both solutions, you need to install AutoHotkey , copy the script for it to disk and run this script via autorun. For autorun, you can, for example, copy it to the C: \ Users \ [UserName] \ AppData \ Roaming \ Microsoft \ Windows \ Start Menu \ Programs \ Startup folder. This script can be run manually by double-clicking on it to test if it works.

First solution.
In Windows 10, it turns out there is a keyboard shortcut that switches the layout to the previous one: Win-Ctrl-Space. In this script, pressing Alt-Shift is converted to pressing Win-Ctrl-Space. The script itself:

; This scripts changes the functionality of Shift + Alt from "switch keyboard layout"
; to "change to previous layout".
; this is usefull when you have more than 2 keyboard layouts and want to switch between
; only 2 of them.
#NoEnv; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir% A_ScriptDir%; Ensures a consistent starting directory.
LAlt & amp; LShift :: send, # ^ {space down} {space up}

I checked this solution – it works. But you need to remember that it switches to the previous language. That is, if you had Chinese enabled, then this script will switch to Chinese, since it was the previous one. Therefore, it will be necessary to manually, using the mouse through the language panel, in turn select two languages, between which you need to switch and after that you can work normally again.

Second solution.
In the second solution, the script directly turns on the desired input language when pressing Alt-Shift. But it needs to be configured before use: set the required language codes. To do this, they need to be recognized somewhere. In the version of the script presented here, the main languages ​​\ u200b \ u200bare Russian and English, an additional language: Japanese.

# SingleInstance force
SendMode Input
; Cycled list of language ids
; refer to https://docs.microsoft.com/en-us/windows/win32/intl/language-identifiers
; and https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings
; for finding out correct values
; in this case 0x409 means standard US English, and 0x419 means standard Russian
AltShiftLangs: = [0x0409, 0x0419]
; 0x411 means japanese IME
CtrlAltLang: = 0x0411
; This returns currently active language id
GetKeyboardLayout () {
 WinGet, WinID ,, A 
ThreadID: = dllcall ("getwindowthreadprocessid", "uint", winid, "uint", 0)
 Return DllCall ("GetKeyBoardLayout", "Uint", Threadid, "Uint") & amp; 0xFFF.
}
; This Sends Request To Change System Language To Lang Argument
SetKeyBoardLayout (Lang) {
 PostMessage, 0x50, Lang ,, A
}
; THIS RETURNS 0-BASED INDEX OF VALUE IN ARR
Indexof (Arr, Value) {
 Loop% Arr.Length ()
  If Arr [A_INDEX] == VALUE {
   RETURN A_INDEX-1
  }
 Return -1.
}
; This Sets Language Based On Current System Lanuage and Next Value by Index in Arr
; If Current Language Is Not Found, IT Sets System to First Language From Arr
SETNEXTLANGUAGE (ARR) {
 lang: = GetKeyBoardLayout ()
 IDX: = INDEXOF (ARR, LANG)
 if (idx & lt; 0) {
  SetKeyBoardLayout (Arr [1])
  Return.
 }
 NEXTIDX: = MOD (IDX + 1, ARR.Length ())
 NEXT: = ARR [NEXTIDX + 1]
 SETKEYBoardLayout (Next)
}
; Alt + Shift Hotkey - Cycle Between Altshiftlangs
Lalt & amp; LSHIFT ::
SETNEXTLANGUAGE (Altshiftlangs)
Return.
; Ctrl + Alt HotKey - Switch Directly to Isolated Ctrlaltlang
LCTRL & amp; Lalt ::
SetKeyBoardLayout (Ctrlaltlang)
Return.

This decision I did not check.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions