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 

swap control and alt keys

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
John H



Joined: 27 Feb 2005
Posts: 2

PostPosted: Sun Feb 27, 2005 9:23 pm    Post subject: swap control and alt keys Reply with quote

Is there a way to swap the control and alt keys? I'd like to do this for both right and left keys, simply swap them. I've made several attempts based on the examples in the help files but they don't seem to work. What I get seems to be that a single press of control sends an alt (and activates the menus), and vice versa I suppose. But I want this to work with key-combinations as well. Can AutoHotkey do this?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Tue Mar 01, 2005 1:51 am    Post subject: Reply with quote

Making Alt become Control seems to work okay on NT4/2k/XP. Here is the newer method that requires v1.0.28 or later:

*LAlt::Send {LControl down}
*LAlt up::Send {LControl up}

However, making Ctrl become Alt is more difficult because those two keys do not cooperate well with each other in that direction. The following seems to be a partial solution, but be warned that it might cause problems with Alt-Tab:

*LControl::Send {LControl up}{LAlt down}
*LControl up::Send {LAlt up}

There might be a way to add more logic to the above to handle Alt-tab better.

You could also try picking some other key (such as LWin) to become Alt and that should work using the method in the first example.
Back to top
View user's profile Send private message Send e-mail
John H



Joined: 27 Feb 2005
Posts: 2

PostPosted: Wed Mar 09, 2005 12:20 pm    Post subject: Reply with quote

I tried your suggestion and it seemed to work. A downside was that when using alt-tab, the graphic of running programs remained visible after the alt-key was deleted. But an even bigger problem was that AutoHotkey would hang. It looked as if the control-key was permanently pressed down, and disabling AutoHotkey didn't solve this. In some cases, all keys were blocked even after logging off my account. A restart was the only solution. I downloaded version 1.0.30 but that didn't solve the problem.

So I'm back to using TradeKeys for swapping control and alt and AutoHotkey for hotkeys of course. I'd prefer to use AhoutHotkey for swapping control and alt though, because TradeKeys swaps them for all accounts, not just mine. If there's a solution to this problem I'd be glad to hear it.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Wed Mar 09, 2005 4:05 pm    Post subject: Reply with quote

It's a complex area that's difficult to improve upon due to the risk of causing side-effects with other features or existing scripts.

You may already know that you can permanently remap keys to each other using the registry. It's "permanent" in the sense that it affects all accounts (I think) and also because the only way to undo it is change the registry back and then reboot.

If you want more info on this method, I can post it.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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