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 

Remap Control,Alt,Capslock

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



Joined: 28 Feb 2006
Posts: 46

PostPosted: Tue Aug 22, 2006 4:47 pm    Post subject: Remap Control,Alt,Capslock Reply with quote

When I stumbled across AutoHotkey a few months ago I was ecstatic
(still am). It allowed me to re-map cursor movements to keyboard
shortcuts systemwide, shortcuts I've used since the '80's (remember
SuperKey?) when I can, like in Word and my text editor.

The problem (sort of) is that my Control, Alt, and Capslock keys have
always been re-mapped at the registry level (Remapkey.exe, which says
it requires re-booting but only requires logging off/logging on to
have the registry changes take effect). So when I want to
cursor-left, I hit Ctrl-j, except my Control key is next to the "a"
key (was the Capslock key).

All of a sudden, I have to work on other people's computers, and it
would be cleaner to incorporate the Control, Alt, Capslock remapping
into my master ahk script. I thought it would be easy, but I can't
get it to work. I can't remember all the things I tried a few months
ago, but the obvious one's didn't work:

Ctrl::Alt
Alt::Capslock
Capslock::Ctrl

or

Ctrl::Send, {Alt}
Alt::Send, {Capslock}
Capslock::Send, {Ctrl}

or

Ctrl::Send, Alt
Alt::Send, Capslock
Capslock::Send, Ctrl


Tried with and without preceding $ and/or *

I tried inserting the code into various places in my script, no joy.
I seem to remember that the Capslock key would correctly become the
Control key, but none of the shortcuts using the Control key would
work.

Below is the current script without trying to remap Ctrl,Alt,Capslock. Any thoughts?

TIA,

Andy

Code:


GroupAdd, Nokeys,  B.exe
GroupAdd, Nokeys,  BoxerLists.EXE
GroupAdd, Nokeys,  HL - HL
GroupAdd, NokeysWord,  B.exe
GroupAdd, NokeysWord,  BoxerLists.EXE
GroupAdd, NokeysWord,  HL - HL
GroupAdd, NokeysWord,  Microsoft Word
SetTitleMatchMode, 2
SetTitleMatchMode, slow
Menu,Tray,Tip,DefKeys
$!+u::
Suspend
Send, !+u
return
#IfWinNotActive, ahk_group NokeysWord
$^l::Send, {Right}
#IfWinNotActive, ahk_group NokeysWord
$^j::Send, {Left}
#IfWinNotActive, ahk_group Nokeys
$^i::Send, {Up}
#IfWinNotActive, ahk_group Nokeys
$^k::Send, {Down}
#IfWinNotActive, ahk_group NokeysWord
$^h::Send, {BS}
#IfWinNotActive, ahk_group NokeysWord
$!h::Send, {Del}
#IfWinNotActive, ahk_group NokeysWord
$+^l::Send, +{Right}
#IfWinNotActive, ahk_group NokeysWord
$+^j::Send, +{Left}
#IfWinNotActive, ahk_group NokeysWord
$+^i::Send, +{Up}
#IfWinNotActive, ahk_group NokeysWord
$+^k::Send, +{Down}
#IfWinNotActive, ahk_group NokeysWord
$^o::Send, ^{Right}
#IfWinNotActive, ahk_group NokeysWord
$^u::Send, ^{Left}
#IfWinNotActive, ahk_group NokeysWord
$+^o::Send, +^{Right}
#IfWinNotActive, ahk_group NokeysWord
$+^u::Send, +^{Left}
#IfWinNotActive, ahk_group NokeysWord
$^p::Send, {Home}
#IfWinNotActive, ahk_group NokeysWord
$^;::Send, {End}
#IfWinNotActive, ahk_group NokeysWord
$+^p::Send, +{Home}
#IfWinNotActive, ahk_group NokeysWord
$+^;::Send, +{End}
#IfWinActive, QuickBooks
$^e::Send, ^e
#IfWinNotActive, ahk_group NokeysWord
$^e::Send, {F2}
#IfWinNotActive, ahk_group Nokeys
$^[::Send, {Esc}
#IfWinActive, Outlook Express
$^m::Send, ^m
#IfWinNotActive, ahk_group NokeysWord
$^m::Send, {Enter}
#IfWinActive, ahk_class #32770
!i::Send, !i
#IfWinActive, ahk_class bosa_sdm_XL9
!i::Send, !i
#IfWinNotActive, ahk_group NokeysWord
!i::Send, {PgUp}
#IfWinNotActive, ahk_group NokeysWord
!k::Send, {PgDn}
#IfWinActive, ahk_class ATH_Note
!n::Send, !tr
Back to top
View user's profile Send private message
Conquer



Joined: 27 Jun 2006
Posts: 385
Location: Canada

PostPosted: Wed Aug 23, 2006 12:06 am    Post subject: Reply with quote

If you're trying to make Ctrl+Alt+Capslock do something,

Code:
^!CapsLock::
Msgbox %A_ThisHotkey% Has been pressed. `n`nThe apocalypse is here!!
return


That remaps the key to display a strange message box. You can also use another label to be launched when the key is pressed if it makes it easier:

Code:
^!CapsLock::
gosub Hotkey1
return

Hotkey1:
Msgbox %A_ThisHotkey% Has been pressed. `n`nThe apocalypse is here!!
return


Though I have no clue why it wouldnt work, be warned.. its..*untested* Laughing
_________________
Back to top
View user's profile Send private message
AndyM



Joined: 28 Feb 2006
Posts: 46

PostPosted: Wed Aug 23, 2006 7:40 pm    Post subject: Reply with quote

Code:
^!CapsLock::
Msgbox %A_ThisHotkey% Has been pressed. `n`nThe apocalypse is here!!
return


Thanks Conquer, but until the apocalypse actually arrives, I want to put the Control, Alt, and Capslock keys where the Computer Gods intended them:

- Control to the left of the "a" key
- Alt in the far lower left corner, below the Shift key
- Capslock out of the way, to the left of the Space Bar

It's no coincidence that the world seems to have gotten quite messy over the last 10-15 years, right when keyboards started being sold with these keys in their current locations. No wonder the apocalypse is coming, but until then I intend to do my part to put these keys back where they belong.

Andy
Back to top
View user's profile Send private message
MsgBox



Joined: 17 Nov 2005
Posts: 179
Location: Leicester, UK

PostPosted: Wed Aug 23, 2006 9:41 pm    Post subject: Reply with quote

Hello AndyM

I have just tried your first example:
Code:
Ctrl::Alt
Alt::Capslock
Capslock::Ctrl

and (not to rub it in) it works fine for me. CapsLock-C, CapsLock-V copied and pasted ok, Alt toggled CapsLock and pressing Ctrl selected File in Firefox's menu. (I'm alright Jack Smile )

AndyM wrote:
Tried with and without preceding $ and/or *

AndyM wrote:
I seem to remember that the Capslock key would correctly become the Control key, but none of the shortcuts using the Control key would work.

Have you tried ~ (you didn't say).

AndyM wrote:
I tried inserting the code into various places in my script, no joy.

See this thread for info about where in a script to put hotkeys and why. It may be useful.
Back to top
View user's profile Send private message Visit poster's website
AndyM



Joined: 28 Feb 2006
Posts: 46

PostPosted: Fri Aug 25, 2006 3:17 pm    Post subject: Reply with quote

SlimlinE wrote:
Hello AndyM

I have just tried your first example:
Code:
Ctrl::Alt
Alt::Capslock
Capslock::Ctrl


and (not to rub it in) it works fine for me.

...

Have you tried ~ (you didn't say).



Remapping the three keys works as a stand-alone script, but it's all
the other key remapping, which uses various combinations of Ctrl, Alt,
and Shift, which no longer work correctly.

(didn't play much with ~ because I do not want the native keys to
fire)

I sort of got things to work by including the Ctrl,Capslock, and Alt
remappings in the Autoexecute section, but things didn't work well.
For example, the Ctrl-j remapping to left cursor wouldn't repeat when
I held down the hotkeys.

I'm giving up for now. My original solution, which was to remap the
Control, Alt, and Capslock keys at the registry level, works
flawlessly, allowing me to use the list of Autohotkey hotkeys
perfectly.

Plus, I suspect I'd never be able to get rid of the beep if I were to
successfully turn the native Capslock key into the Control key. Since
I use Control-<key> combinations extensively, the Capslock beep would
drive me nuts.

Thanks for trying.

Andy
Back to top
View user's profile Send private message
Precise



Joined: 30 Dec 2007
Posts: 18
Location: East Coast

PostPosted: Wed Jan 23, 2008 9:30 pm    Post subject: Reply with quote

Theres got to be a way to get rid of the beep.
Back to top
View user's profile Send private message
AndyM



Joined: 28 Feb 2006
Posts: 46

PostPosted: Wed Jan 23, 2008 10:46 pm    Post subject: Reply with quote

precisewitit wrote:
Theres got to be a way to get rid of the beep.


I'm still interested if you have any ideas, but it's more than just the beep.

I'm fine in my office on my machine - everything works slick. But I'm looking for a way to be able to use any machine I sit down at, and that would require easily remapping the Control, Alt, and Capslock keys while still having the rest of my scripts work. Otherwise I'm still stuck with using Remapkey.exe for Ctrl-Alt-Capslock, logging off and back on, and then reversing the process to put the keys back the way I found them. If I could do it all with autohotkey scripts it would be far easier (and more polite than fooling with someone's registry).
Back to top
View user's profile Send private message
Democratus



Joined: 01 Sep 2007
Posts: 120

PostPosted: Wed Jan 23, 2008 10:49 pm    Post subject: Reply with quote

Have you tried just emulating the pressing down of the keys? I'm not familiar with the old layout (I'm 18), so I'm not really sure how comfortable it could possibly be, but if you're trying to combine them you could remap them with something like:
Capslock::Send {Ctrl down}
Then detect when the user releases the capslock key and cause it to release (or send up). This way you should be able to do all of the combinations you intended to incorporate, though it'll make the script a bit larger to detect when the user releases each of the keys with timers.
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Wed Jan 23, 2008 10:50 pm    Post subject: Reply with quote

This is just speculation, but I wonder if there's any chance it would work better wither two scripts: One to do the remap and one for the rest.
Back to top
View user's profile Send private message
AndyM



Joined: 28 Feb 2006
Posts: 46

PostPosted: Thu Jan 24, 2008 1:22 am    Post subject: Reply with quote

ManaUser wrote:
This is just speculation, but I wonder if there's any chance it would work better wither two scripts: One to do the remap and one for the rest.


It's been a while, but I'm pretty sure I tried that first. That didn't work well so I thought having it all in one place would make the remapping and the other scripts play well together.
Back to top
View user's profile Send private message
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