Reputation: 45
I want to remap the 'H' to 'V', but also when I am typing in Arabic I want to remap 'ا' to 'ر', the 'ا' and 'ر' are in the same keys as 'H' and 'V' respectively. so I tried to do h:: send v;
. when I am typing in English everything is perfect but in Arabic, it actually types 'v' instead of 'ر'.
Note: I am currently checking the language and sending the keystroke in the appropriate language, but I am remapping a lot of keys so it is kind of tedious and I think there must be an easier way, Is there an easier way?
Thanks in advance.
Upvotes: 0
Views: 393
Reputation: 2342
When you do Send v
, AutoHotkey sends a v
character. You don't want the character, though, you want it to push whatever key would be the v
key on an English keyboard. You can do this using a virtual key code. The idea behind virtual key codes is that each code corresponds to a physical key on the keyboard, and not what character is produced on the screen. There are two ways to implement this.
h::Send {v}
- Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar.
- Double-click that script's tray icon to open its main window.
- Press one of the "mystery keys" on your keyboard.
- Select the menu item "View->Key history"
- Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key.
Make a note of the 2-digit value in the first column of the list. V is 56
on my Windows 10 machine, but numbers are platform-dependent. You can then use that 2-digit virtual key code in your send command, like so:
h::Send {vk56}
This syntax is documented here.
Upvotes: 2