I have a standalone numpad with a few extra buttons. Everything maps to standard scan codes except for 3 buttons, 2 for parenthesis, and one for =
The problem is those keys actually are sending the alt code combo for those symbols. There are no drivers, it's just happening in the hardware. I want to remap those keys for something more useful, but I'm not sure how to intercept the input.
Here is an example keyhistory of pressing the ( button once:
A4 038 d 1.03 LAlt
60 052 d 0.01 Numpad0
60 052 u 0.02 Numpad0
64 04B d 0.00 Numpad4
64 04B u 0.00 Numpad4
60 052 d 0.00 Numpad0
A4 038 u 0.02 LAlt
60 052 u 0.00 Numpad0
Does anyone know how to detect that series of keypresses in AHK?
hotstring input consisting of special characters
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
So you have tried this and found that it does not work?
Code: Select all
(::MsgBox, 64, Result, Test
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
No luck, it just sends the ( symbol
That test does work if I press shift+9 though
That test does work if I press shift+9 though
Re: hotstring input consisting of special characters
This probably does not help, but perhaps it is an idea in the right direction.
Code: Select all
Alt Up::Input
Alt:: ; https://autohotkey.com/board/topic/121922-hotkeys-like-altnumpad/
Input text
Send % text = "040" ? "x" : ""
Return
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
Ooh, that does work!
can you point me to some syntax info on this construction: text = "040" ? "x" : ""
I think I know what's going on there, but some more direction would be appreciated
can you point me to some syntax info on this construction: text = "040" ? "x" : ""
I think I know what's going on there, but some more direction would be appreciated
Re: hotstring input consisting of special characters
It's just If... then... else.
Code: Select all
Alt Up::Input
Alt:: ; https://autohotkey.com/board/topic/121922-hotkeys-like-altnumpad/
Input text
If (text = "040")
Send x
Return
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
Ok, I found it, the ternary operator. I rewrote it as a series of if else statements to wrap those 3 keys into one function, and it works great!
But, I can no longer manually enter alt-codes. Not really a dealbreaker, I only ever need it for the degree symbol (alt+0248), so I just built another if into my function to detect that and send the symbol.
Thank you so much for your help! If you ever need any help with 3D rendering or animation, find me on the blenderartists forum, I'd love to return the favor.
Thanks again!
But, I can no longer manually enter alt-codes. Not really a dealbreaker, I only ever need it for the degree symbol (alt+0248), so I just built another if into my function to detect that and send the symbol.
Thank you so much for your help! If you ever need any help with 3D rendering or animation, find me on the blenderartists forum, I'd love to return the favor.
Thanks again!
Re: hotstring input consisting of special characters
Thanks! I'm glad it worked (more or less).
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
on further review, this breaks any other hotkey that uses alt, haha
Any tips on setting up a timeout override? My numpad pounds out those keycodes in under .06 seconds, so any fast input could be detected and anything happening at a more human pace could still passthrough.
Any tips on setting up a timeout override? My numpad pounds out those keycodes in under .06 seconds, so any fast input could be detected and anything happening at a more human pace could still passthrough.
Re: hotstring input consisting of special characters
You can try things like the following. Reviewing documentation for Input might provide additional ideas.
Code: Select all
Alt Up::Input
Alt:: ; https://autohotkey.com/board/topic/121922-hotkeys-like-altnumpad/
Input text
If (text = "040")
Send x
Else Send !%text%
Return
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
I added the send !%text% to my last if, and it is still breaking my other shortcuts. I use a lot of alt+clicking in my programs and non of those work at all.mikeyww wrote: ↑15 Jul 2021, 19:07You can try things like the following. Reviewing documentation for Input might provide additional ideas.
Code: Select all
Alt Up::Input Alt:: ; https://autohotkey.com/board/topic/121922-hotkeys-like-altnumpad/ Input text If (text = "040") Send x Else Send !%text% Return
I added a 100 millisecond timeout to the input command, as the virtual keystrokes are sent real fast. Is there anyway to just exit the hotkey script and dump it back to standard operation?
Re: hotstring input consisting of special characters
ExitApp works, but it sounded like you needed your other hotkeys. Perhaps others on the forum have additional ideas.
-
- Posts: 7
- Joined: 15 Jul 2021, 13:05
Re: hotstring input consisting of special characters
I do need the other hotkeys, but the alt hotkey script is gumming up other hotkeys.
If I could get the AHK hotkey that listens for the alt code to do its job in 100 milliseconds, then revert back to standard alt key held down behavior, that would solve my issues.
If I could get the AHK hotkey that listens for the alt code to do its job in 100 milliseconds, then revert back to standard alt key held down behavior, that would solve my issues.
Re: hotstring input consisting of special characters
I would suggest trying <!Numpad0:: rather than Alt::, to start the sequence. The rest of the sequence can be detected either with additional hotkeys (either unconditional or using the Hotkey command or #If) or Input as before.
Who is online
Users browsing this forum: Google [Bot], inseption86, peter_ahk, Rohwedder, william_ahk and 208 guests