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 ?
-
What keyboard language/ setup are you using in the image? – Spyre May 15 '21 at 14:07
-
I am using an AZERTY french layout. – hsatouev May 15 '21 at 20:04
-
Do now upload Images, Read [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) – Mayur May 16 '21 at 18:16
2 Answers
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.

- 5,948
- 1
- 12
- 17
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/

- 2,234
- 1
- 4
- 24
-
1`:::/` should be just fine. If not, update your AHK installation. However, due to [this](https://www.autohotkey.com/docs/misc/Remap.htm#actually), certain keyboard layouts will require `:::SendInput, /` to be used. My guess is that on OP's keyboard layout wont need to use a send command, but yeah. – 0x464e May 15 '21 at 00:32
-
@Spyre I tested your code but it changes nothing, I have AHK v1.1.33.02 btw. – hsatouev May 15 '21 at 12:28
-
@0x464e The 1st command doesn't work. 2nd command is working great but I tried to apply it to remap shift+colon to colon : `+:::SendInput, :` It returns an error code. – hsatouev May 15 '21 at 12:34
-
So wait, what's your keyboard layout like? You have a `:` key, and if it's shifted, it sends `/`? And you want to swap these around? So not shifting would send `/` and shifting would send `:`? – 0x464e May 15 '21 at 17:14
-
I have a french AZERTY layout and that's exactly what I am trying to do. I have already managed to swap `,` with `?` and `;` with `.` but I can't find a way to swap `:` with `/`. Basicaly a swap between non-shifted and shifted keys. I used : `:?C*:;::{.}` and `:?C*:.::{;}` to swap `;` with `.`. This method doesn't work for `:` and `/`. – hsatouev May 15 '21 at 20:13
-
-