 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
AndyM
Joined: 28 Feb 2006 Posts: 46
|
Posted: Tue Aug 22, 2006 4:47 pm Post subject: Remap Control,Alt,Capslock |
|
|
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 |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 385 Location: Canada
|
Posted: Wed Aug 23, 2006 12:06 am Post subject: |
|
|
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*  _________________
 |
|
| Back to top |
|
 |
AndyM
Joined: 28 Feb 2006 Posts: 46
|
Posted: Wed Aug 23, 2006 7:40 pm Post subject: |
|
|
| 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 |
|
 |
MsgBox
Joined: 17 Nov 2005 Posts: 179 Location: Leicester, UK
|
Posted: Wed Aug 23, 2006 9:41 pm Post subject: |
|
|
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 )
| 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 |
|
 |
AndyM
Joined: 28 Feb 2006 Posts: 46
|
Posted: Fri Aug 25, 2006 3:17 pm Post subject: |
|
|
| 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 |
|
 |
Precise
Joined: 30 Dec 2007 Posts: 18 Location: East Coast
|
Posted: Wed Jan 23, 2008 9:30 pm Post subject: |
|
|
| Theres got to be a way to get rid of the beep. |
|
| Back to top |
|
 |
AndyM
Joined: 28 Feb 2006 Posts: 46
|
Posted: Wed Jan 23, 2008 10:46 pm Post subject: |
|
|
| 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 |
|
 |
Democratus
Joined: 01 Sep 2007 Posts: 120
|
Posted: Wed Jan 23, 2008 10:49 pm Post subject: |
|
|
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 |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 906
|
Posted: Wed Jan 23, 2008 10:50 pm Post subject: |
|
|
| 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 |
|
 |
AndyM
Joined: 28 Feb 2006 Posts: 46
|
Posted: Thu Jan 24, 2008 1:22 am Post subject: |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|