Reputation: 11
I searched for hours but can't find a way to swap :
with it's shifted key /
. I am new to AutotHotkey. Can someone help me ?
colon key with slash (shifted)
Upvotes: 1
Views: 875
Reputation: 1
I found the methods here didn't work for me, but the following worked to remap NumLock to output a colon:
NumLock:: SendInput ":"
Upvotes: 0
Reputation: 6489
Answer for the updated question from comments:
The layout is French AZERTY. The layout has a
:
key, and if it's shifted, it sends/
. These should be swapped around so not shifting would send/
and shifting would send:
.
So the trick is to just send the other key, when other key is detected. Like so:
#UseHook
:::SendInput, /
/::SendInput, :
Using the keyboard hook #UseHook
(docs) is important to make the hotkeys not trigger each other.
Normally this could be done with the $
(docs) prefix, but due to bug in the syntax, $:::
comes up as a syntax error.
Also, why couldn't the simple remapping syntax be used?
:::/
/:::
It's because the remapping syntax uses the blind sendmode(docs), which would cause the shift modifier to pass through and you'd always end up with the shifted variant of the key.
Technically you can use the remapping syntax for the first hotkey like this:
:::/
/::SendInput, :
This also wouldn't require you to use the keyboard hook, due to DownR
(docs) being used in the remapping syntax.
Upvotes: 1
Reputation: 2344
Since we cannot use the typical remap sequence here (i.e. ::
), we can instead use the Hotkey command to detect when the Colon is pressed, and then to remap it to a label
Hotkey, :, ColonDetected
return
ColonDetected:
Send, /
Answer based on this post in the AHK forums: https://autohotkey.com/board/topic/99092-remap-colon-key-help/
Upvotes: 0