Implementing alt codes on a keyboard without a numpad
Implementing alt codes on a keyboard without a numpad
Hi, it's me again!
I have some experience with AutoHotkey, but haven't got too deep into it. I wonder if I could use it to simulate a num pad to type alt codes.
I recently bought a laptop that does not have a real num pad but also not a virtual num pad, for some reason. With this keyboard it is not at all possible to type alt codes. Can AutoHotkey implement a virtual num pad? For example being able to type fn + alt + M, K, L, L to send alt code 0233 (becoming é). I've googled for this and also searched this forum, but couldn't find the question asked, to my surprise. Let me know if I looked over it!
I have some experience with AutoHotkey, but haven't got too deep into it. I wonder if I could use it to simulate a num pad to type alt codes.
I recently bought a laptop that does not have a real num pad but also not a virtual num pad, for some reason. With this keyboard it is not at all possible to type alt codes. Can AutoHotkey implement a virtual num pad? For example being able to type fn + alt + M, K, L, L to send alt code 0233 (becoming é). I've googled for this and also searched this forum, but couldn't find the question asked, to my surprise. Let me know if I looked over it!
Re: Implementing alt codes on a keyboard without a numpad
Code: Select all
char := {e: "é", x: "y"}
!m::
Input, key, L1
Send % char.HasKey(key) ? char[key] : key
Return
Code: Select all
:?*:eee::é
Re: Implementing alt codes on a keyboard without a numpad
It seems to me that your solution concerns specific characters, and doesn't even use the alt codes. I don't think it is relevant to my problem. Although it could be good as a temporary workaround (for accents however, there is a workaround built in-to Windows: add an international keyboard, press ctrl + shift to switch, type ', ", or `, and type the letter (for example ' + e becomes é), then press ctrl + shift to switch back to the regular keyboard).mikeyww wrote: ↑11 Nov 2021, 08:02Hotstrings are also a good solution.Code: Select all
char := {e: "é", x: "y"} !m:: Input, key, L1 Send % char.HasKey(key) ? char[key] : key Return
Code: Select all
:?*:eee::é
Re: Implementing alt codes on a keyboard without a numpad
Code: Select all
#!m:: ; WIN-ALT-M = Send ASCII character
SoundBeep, 1700
Input, key, L3
str := key
For letter, number in {j: 1, k: 2, l: 3, u: 4, i: 5, o: 6, m: 0}
str := StrReplace(str, letter, number)
Send % str ~= "^\d+$" ? Format("{ASC {:04}}", str) : key
Return
Re: Implementing alt codes on a keyboard without a numpad
Sorry for the very late reply...
Thank you, that works! It only supports the four character ALT codes, and not the one to three character ones. This should be very useful, in any case! Maybe I'll try if I can make it support any length by using EndKeys over the holidays.mikeyww wrote: ↑13 Nov 2021, 09:09Code: Select all
#!m:: ; WIN-ALT-M = Send ASCII character SoundBeep, 1700 Input, key, L3 str := key For letter, number in {j: 1, k: 2, l: 3, u: 4, i: 5, o: 6, m: 0} str := StrReplace(str, letter, number) Send % str ~= "^\d+$" ? Format("{ASC {:04}}", str) : key Return
Re: Implementing alt codes on a keyboard without a numpad
Sure, you can do this kind of thing.
Code: Select all
#!m:: ; WIN-ALT-M = Send ASCII character
SoundBeep, 1700
Input, key, L4, {Enter}
str := key
For letter, number in {j: 1, k: 2, l: 3, u: 4, i: 5, o: 6, m: 0}
str := StrReplace(str, letter, number)
Send % str ~= "^\d+$" ? Format("{ASC {:0" StrLen(str) "}}", str) : key
Return
- 12Centuries
- Posts: 5
- Joined: 26 Aug 2021, 16:07
Re: Implementing alt codes on a keyboard without a numpad
Another great approach to this is here: viewtopic.php?p=331322#p331322
Allows you to use the alt key and the top-row numbers to enter any ascii code.
Allows you to use the alt key and the top-row numbers to enter any ascii code.