[Class] Dynamic RegEx Hotstrings - v1.1.22.02+

Post your working scripts, libraries and tools for AHK v1.1 and older
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Class] Dynamic RegEx Hotstrings - v1.1.22.02+

09 Oct 2015, 00:43

GeekDude wrote:@lexikos: What do you think the advantages/disadvantages of scrapping the tons of hotkey commands in favor of an actual keyboard hook would be? As I understand it AHK does some kind of special processing that makes the hotkey commands more reliable across OS, Languages, etc. I'm not sure if this would also apply to my own hook if I run everything through GetKeyName() or similar.
Advantages of using a hook:
- Reduces the risk of conflicts with other parts of the script using the same hotkeys, or hitting the hotkey limit.
- You can conditionally block the end character and send one less backspace. (Built-in hotstrings do this.)
- Greater accuracy - if done correctly, can handle a wider range of keyboard layouts, including dead keys.

Disadvantages of using a hook:
- Each hook adds a very small amount of latency to the input, and more so for a scripted hook than the built-in hook.
- If the script becomes unresponsive, keyboard input halts until it times out, after which the script will need to be restarted or reinstall its hook.
- Probably more complex (but that's the cost of greater accuracy).
- May reduce the reliability/uninterruptibility of SendInput (but this is irrelevant if you already have multiple running scripts with built-in hooks).

There are some complexities in how hotkeys are recognized, but mostly that doesn't apply to hotstrings. There's not a lot of adaptation for "OS" and "Languages" for hook hotkeys.

Do not use GetKeyName to translate keycodes to characters; use ToUnicodeEx as we previously discussed. Usage is demonstrated (imperfectly) here.
fmoon
Posts: 2
Joined: 09 Feb 2024, 12:08

Re: [Class] Dynamic RegEx Hotstrings - v1.1.22.02+

13 Feb 2024, 11:45

Hello,
I tried this class, and I get this error : ~ is not a valid key name. in the line of

Code: Select all

if (A_Index < 33 || A_Index > 58)
----->				Hotkey, % m . Chr(A_Index+32), %target%
it does not like the ~ of the m and Prefix := "*~$"
I alos got the same message using the same function obtained here.
https://www.computoredge.com/AutoHotkey/Downloads/RegExHotstrings.ahk



I have autohotkey v 1.1.37.01

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Rohwedder and 235 guests