AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compatible Hotkeys in Colemak & Dvorak Layout

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
rogal



Joined: 23 Dec 2007
Posts: 51
Location: Austin

PostPosted: Sun Dec 30, 2007 8:51 am    Post subject: Compatible Hotkeys in Colemak & Dvorak Layout Reply with quote

First of all, you can switch between layouts easily with the following great script.
http://www.autohotkey.com/forum/viewtopic.php?t=27029

Then you can recognize which layout is in effect by using the following function:

Code:
key_layout()
{
    WinGet, Active_Window_ID, ID, A
    Active_Window_Thread := DllCall("GetWindowThreadProcessId"
        , "UInt", Active_Window_ID, "UInt", 0)
    return DllCall("GetKeyboardLayout", "UInt", Active_Window_Thread)
}


then, you can define hotkeys accordingly:

Code:
Lay_Colemak := -255851511
#UseHook On

^r::
   Lang_In_Window := lang_layout()

   if (Lang_In_Window=Lay_Colemak) 
      send, ^s
   Else
      send, ^r
return



;The same function as above

key_layout()
{
    WinGet, Active_Window_ID, ID, A
    Active_Window_Thread := DllCall("GetWindowThreadProcessId"
        , "UInt", Active_Window_ID, "UInt", 0)
    return DllCall("GetKeyboardLayout", "UInt", Active_Window_Thread)
}


In Colemak layout, s becomes r, so the above example will send ^s when you press ^r in Colemak.

PS: Changing layout is superior to remapping all keys since if you remap keys, hotstrings will not work.
Back to top
View user's profile Send private message
TheLeO



Joined: 11 Jun 2005
Posts: 160
Location: England ish

PostPosted: Mon Mar 10, 2008 1:07 pm    Post subject: Reply with quote

thanks for the idea, i'll give it a try...

by the way, I just found out about colemak, do you know whats the fastest/easiest/mosy fun way to learn it?
_________________
And i say: where there is a problem , there is a solution.(well some where that is.)
::
I Have Spoken
::
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rogal



Joined: 23 Dec 2007
Posts: 51
Location: Austin

PostPosted: Mon Mar 10, 2008 3:47 pm    Post subject: Reply with quote

TheLeO, I have already sent you a message Smile.

Actually I don't use the hotkey thing anymore. I have found much better way to preserve all the hotkeys.

If you modify Colemak layout and make the VK values be the same with QWERTY, then the all the hotkeys will be preserved. (since if you press a key with modifier such as CTRL, the VK values is sent).

In order to do that, you have to directly edit the Colemak layout source file with text editor, and copy/paste QWERTY VK values, since you cannot change VK values with Microsoft Keyboard Layout Creator 1.4.

Finally, in order to preserve windows key hotkeys, you have to boot with QWERTY as standard, and then change to Colemak. The VK value trick does not work with windows key. I made a AHK code to switch(toggle) to Colemak so when I press Shift + space my keyboard layout is switched to colemak.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group