topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday April 29, 2024, 11:17 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Is there a utility that can remap a given key or shortcut to a unicode char?  (Read 4309 times)

Twinbee

  • Member
  • Joined in 2012
  • **
  • Posts: 84
    • View Profile
    • Donate to Member
Although I live in the UK, due to circumstances beyond my control, I am now using a US keyboard, and have therefore set the keyboard layout to US in Windows 11.

I don't want to faff around with the shortcut of "ALT key and type the number 0163" to obtain the £ symbol. Instead I just want to use something like Right Alt + 4 to obtain it. Microsoft Powertoys allows you to remap keys. However, it doesn't seem to allow a £ symbol in the "Mapped to" section (unless one of the special VK "Virtual Key" codes might do the trick).

I've tried pretty much all the keyboard remapping tools shown here, but unfortunately, none of them allow you to remap to a key outside the current keyboard character space. Since the £ symbol doesn't exist in the US keyboard layout, they therefore don't allow you to map to that character.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,751
    • View Profile
    • Read more about this member.
    • Donate to Member
Try looking into "text expanders" or even AutoHotKey (AHK) rather than key remappers.

Twinbee

  • Member
  • Joined in 2012
  • **
  • Posts: 84
    • View Profile
    • Donate to Member
Thanks, I have looked at a few text expanders, but the ones I saw either didn't support shortcuts (like using Ctrl + another key) or were quite slow to action upon pressing the key.

AHK is a bit overkill, but I'll use that as a last resort.

I'll keep hunting!

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,751
    • View Profile
    • Read more about this member.
    • Donate to Member
I think it could be done with AHK (v2) with something as simple as:

Code: Autohotkey [Select]
  1. ; Alt-4 prints £
  2. !4::
  3. {
  4.     Send "£"
  5. }

Twinbee

  • Member
  • Joined in 2012
  • **
  • Posts: 84
    • View Profile
    • Donate to Member
Lol, I couldn't resist a quick try and......... it works!! Albeit uses the left Alt key (rather than the right), which I think I actually prefer. Found the right alt would be simply ">!".

Thank you! Maybe I'll just stick with this then. I have used AHK for other stuff before. Maybe I can make an exe out of it, and/or simply stick the ahk/exe in the startup folder.

I figured out the other missing keys too. For anyone who lives in the UK, but who has a US keyboard, this code should do the trick for the missing symbols: £ (Pound sign), ¬ (Negation or Not sign), ¦ (Broken Bar), and € (Euro sign).

Code: Autohotkey [Select]
  1. !4::£      ; Alt+4 prints £
  2. !`::¬      ; Alt+` prints ¬
  3. !\::¦      ; Alt+\ prints ¦
  4. >!4::€     ; AltGr+4 prints

EDITED: For even simpler syntax.

Docs here: https://www.autohotk...wto/WriteHotkeys.htm
« Last Edit: April 10, 2023, 05:29 PM by Twinbee »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,751
    • View Profile
    • Read more about this member.
    • Donate to Member
I'm glad I could be of some help. :Thmbsup:

Twinbee

  • Member
  • Joined in 2012
  • **
  • Posts: 84
    • View Profile
    • Donate to Member
It's easier than I expected! Maybe AHK v2 is helping over v1. Btw, the script can be simplified to even avoid the braces etc. Simply: "!4::£" will map from Alt+4 to £. Source: https://www.autohotk...cs/v2/misc/Remap.htm

Love the way you can make it application dependent too. E.g:

Code: Autohotkey [Select]
  1. #HotIf WinActive("Chrome")
  2. F2::+F3  ; This allows you to use the F2 key to action the very common "Find previous" function in Google Chrome, rather than painfully using the default Shift+F3
  3. #HotIf  ; This puts subsequent remappings and hotkeys in effect for all windows.

EDIT: Also found out that ATMsoft's Key Manager also did the trick, in a nice easy to use interface, though it does cost $60 for a license.
« Last Edit: April 10, 2023, 06:18 PM by Twinbee »