Reputation: 14563
I'm using a different keyboard layout, using AHK's qwerty to colemak script. It remaps letters to different letters. How can I disable it when either the ctrl, alt, or windows key is down. This way hotkeys like ctrl+s to save should still work!
Edit: I got the script from here http://colemak.com/wiki/index.php?title=Download
It just looks like this
r::p
t::g
y::j
u::l
Upvotes: 4
Views: 3056
Reputation:
including the code of the script or providing a link to the script (i was searching it myself but could not find it) would help.
If remaping in the script was done correctly the combination Ctrl + S should still work, although the physical position of the key has changed. As i have seen in the layout
http://colemak.com/wiki/images/8/80/Colemak_layout_2.png
s isn't that far away from the original s so you could try just remembering it.
The usual solution for disabling the hotkeys is:
Suspend, On
http://www.autohotkey.com/docs/commands/Suspend.htm
Since i didn't see the script i don't know if it will work.
Upvotes: 0
Reputation: 7953
Although I wrote in the comment above that I think this conditional disabling is not required, here is some code. I used the letter f and tested in in Notepad. Pressing f returns Hello Pressing ^f should give hELLO, but since the #IF is not true the notepad find opens up since the system sends a regular Ctrl+f. Same for !f, this opens up the File menu. WARNING you MUST have autoHotKey_L installed for #IF to work!
#If (NOT ((GetKeyState("Control", "P")) OR (GetKeyState("Alt", "P"))))
f::Send, Hello ; Should execute as long as Ctrl or Alt are not pressed.
*a::Send, QQQQ ; The * ignores all modyfiers, not executed when Alt or Ctrl is pressed.
^f::Send, hELLO ; should never execute due to #IF = False
!f::Send, olleh ; should never execute due to #IF = False
#IF
Upvotes: 2
Reputation: 2592
Use Suspend
to disable hotkeys.
Use ~
tells AHK not to block the native event.
Then use Suspend
again to re-enable the hotkeys.
~Ctrl::Suspend, On
~Ctrl Up::Suspend, Off
~Alt::Suspend, On
~Alt Up::Suspend, Off
~LWin::Suspend, On
~LWin Up::Suspend, Off
Upvotes: 3
Reputation: 7953
Same as above. Not sure about the script. An idea might be to use the autoHotKey_L #if function and place the re-assigned keys inside the #IF. The #IF should then be created around the modifier keys not being pressed.
Upvotes: 0