Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Detecting the currently-active language


  • Please log in to reply
4 replies to this topic
cool-RR
  • Members
  • 134 posts
  • Last active: Jul 05 2015 08:19 AM
  • Joined: 27 Oct 2011
Hello,

I have a script that should run in different ways depending on the currently-active language. So if the active language is English, it should behave one way, but if it's Hebrew, it should behave in a different way.

Is it possible to detect the language using AHK?


Thanks,
Ram.

Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Something like this ? However it's the system language and not the keyboard layout, a lot of Windows are in english but have an other language in reality...
msgbox % A_Language ; XX09=english , XX0D=hebrew

"You annoy me, therefore I exist."

cool-RR
  • Members
  • 134 posts
  • Last active: Jul 05 2015 08:19 AM
  • Joined: 27 Oct 2011
Ah, I guess I meant the keyboard layout. I meant the one that you can change by clicking Alt-Shift.

Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Maybe they are other method or language feature to get... But try this

#NoEnv
; XX09=english , XX0D=hebrew
; http://msdn.microsoft.com/en-us/library/aa912040 or "Language Codes" of autohotkey.chm

F5::
; method 1
SetFormat, Integer, H
msgbox % DllCall("GetKeyboardLayout", Int,DllCall("GetWindowThreadProcessId", int,WinActive("A"), Int,0))
SetFormat, Integer, D

; method 2
VarSetCapacity(kbd, 9)
if DllCall("GetKeyboardLayoutName", uint, &kbd)
  msgbox % kbd
Return

edit: check this link too
<!-- m -->http://www.autohotke...pic.php?t=27029<!-- m -->
<!-- m -->http://www.autohotke...pic.php?t=75148<!-- m -->
"You annoy me, therefore I exist."

cool-RR
  • Members
  • 134 posts
  • Last active: Jul 05 2015 08:19 AM
  • Joined: 27 Oct 2011
Works, thanks!

And thanks also for those 2 links, they were interesting!