Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script reveal additional English language (English International) #1

Open
pojitonov opened this issue Jan 1, 2021 · 1 comment
Open

Comments

@pojitonov
Copy link

pojitonov commented Jan 1, 2021

I have modified the script to switch between languages by using simple hotkeys like Ctrl+1, Ctrl+2 etc.

en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
ru := DllCall("LoadKeyboardLayout", "Str", "00000419", "Int", 1)
ua := DllCall("LoadKeyboardLayout", "Str", "00000422", "Int", 1)

SetLayout(language){
  ControlGetFocus, control, A
  ;SplashTextOn,,, % "" . language
  PostMessage 0x50, 0, %language%, %control%, A ; WM_INPUTLANGCHANGEREQUEST
}

^1::
	SetLayout(en)
	Return

^2::
	SetLayout(ru)
	Return

^3::
	SetLayout(ua)
	Return

It works fine but it reveals the additional version of English.
I have noticed that the script reveals the additional English (International) when I am launching it.
Screenshot 2021-01-01 211939
The original version does the same.

@yuryzaytsev
Copy link

yuryzaytsev commented Mar 10, 2021

If you want to avoid this, you need to use a correct keyboard layout identifiers, instead of values from Locale Mapping Table.

; Get a current keyboard layout identifier

GetLANGID() {
  w := DllCall("GetForegroundWindow")
  pid := DllCall("GetWindowThreadProcessId", "UInt", w, "Ptr", 0)
  r := DllCall("GetKeyboardLayout", "UInt", pid)
  return r
}

See full solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants