Jump to content

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

Changing Keyboard Layout with Grave Accent (`)


  • Please log in to reply
3 replies to this topic
Pongpyng
  • Members
  • 15 posts
  • Last active: Jan 05 2008 01:17 AM
  • Joined: 28 Apr 2007
As I use English and Thai layout very often so I use these 2 as a default layout but I sometimes use Japanese as well so i have to add it from the setting. Everytime I add Japanese layout it mess up my language bar position. And everytime i finish I'll have to remove the layout since there will be too much layout to switch using Grave Accent causes confusing.

So, What I'm trying to do is add all 3 layouts but assign Grave Accent to switch only between English and Thai (and whenever i want to type in Japanese i just use the mouse to change it manually from the language bar)

here is the code

`::
SetFormat, Integer, H 
  WinGet, WinID,, A 
  ThreadID:=DllCall("GetWindowThreadProcessId", "Int", WinID, "Int", 0) 
  InputLocaleID:=DllCall("GetKeyboardLayout", "Int", ThreadID) 

if InputLocaleID=0x4090409 ;if Eng layout switch to Th
{
	Send {Shift Down}{Alt Down}{2}{Alt Up}{Shift Up}
	Return
}

if InputLocaleID=0x41e041e ;if Th layout switch to Eng
{
	Send {Shift Down}{Alt Down}{1}{Alt Up}{Shift Up}
	Return
}

if InputLocaleID=-0x1ffefbef ;if Jap layout switch to Eng
{
	Send {Shift Down}{Alt Down}{1}{Alt Up}{Shift Up}
	Return
}

When the layout is Eng, it changes to thai perfectly. but the problem is when it changed to Th, the Grave Accent button is no longer Grave Accent anymore. it becomes "_" and the code just does not work. :cry: I tried to put "_::" together in the code but still it does not work. Could you please help me out? :shock:

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
maybe you can find where on the Thai keyboard ` is located so you can press it?

Pongpyng
  • Members
  • 15 posts
  • Last active: Jan 05 2008 01:17 AM
  • Joined: 28 Apr 2007
I don't think there's "`" in thai keyboard layout and is there anyway to use the same button? since it would be better to have only one toggle key for changing keyboard layout just like windows default :)

`:: 
SetFormat, Integer, H 
  WinGet, WinID,, A 
  ThreadID:=DllCall("GetWindowThreadProcessId", "Int", WinID, "Int", 0) 
  InputLocaleID:=DllCall("GetKeyboardLayout", "Int", ThreadID) 

if InputLocaleID=0x4090409 ;if Eng layout switch to Th 
{ 
   Send {Shift Down}{Alt Down}{2}{Alt Up}{Shift Up} 
   Return 
}

if InputLocaleID=-0x1ffefbef ;if Jap layout switch to Eng 
{ 
   Send {Shift Down}{Alt Down}{1}{Alt Up}{Shift Up} 
   Return 
}

_:: ; I tried to change to toggle command when it is in thai layout but this doesn't work  :(  
SetFormat, Integer, H 
  WinGet, WinID,, A 
  ThreadID:=DllCall("GetWindowThreadProcessId", "Int", WinID, "Int", 0) 
  InputLocaleID:=DllCall("GetKeyboardLayout", "Int", ThreadID) 

if InputLocaleID=0x41e041e ;if Th layout switch to Eng 
{ 
   Send {Shift Down}{Alt Down}{1}{Alt Up}{Shift Up} 
   Return 
} 

This is what i've tried but "_::" just doesn't work.. :?:


ADD: come to think again i don't think using "_" as a toggle command is a good idea since I won't be able to type "underscore"... I'm still thinking what to do (T_T )

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
I'm always a fan of scrolllock for things like this.