Page 1 of 1

HotString function

Posted: 28 Sep 2017, 17:08
by SirRFI
Is there any reason why HotStrings do not have function counterpart, or even anything else than the ::thx::Thanks! syntax? Or at least I failed to find any in-built, so please correct me if I am wrong and point the direction.

Hotstring function would allow to dynamically (again - if that's proper term) create them, from an array/object or reading a file. I have found usage for this many times, and I either used a library or made something on my own (but both were likely not as effective as inbuilt may be), or simply gave up on the idea. At the same time it is possible to create hotkeys in loop using a function.

Assuming my points are valid, I would love to see this implemented.

Re: HotString function

Posted: 06 Oct 2017, 12:34
by egocarib
This kind of thing is currently supported by a user-released Dynamic Hotstrings library available for v1. I don't think anyone has translated it to work for v2 yet, last I checked.

Typically, I think that the intent of v2 is more to optimize the existing language, rather than build out or support entirely new features. However, in this particular case, I agree with SirRFI that it would make sense to add this functionality. Hotstrings are core to the original purpose and identity of autohotkey. Most casual users of autohotkey use it for hotstrings or very simple hotkey-launched code snippets. Making dynamic hotstrings a built in feature (with a hotstring function like the one SirRFI suggests above) seems like it would be quite useful to many typical AHK users and would support that core identity of the language.

For example, I work at a large software company where many users use autohotkey for small internal tools & helper utilities. Those users don't typically use many of the advanced features of the language, such as GUI or DllCall, but if dynamic hotkeys were a feature, I am sure that they would see a lot of use by the kinds of users I see here.

Re: HotString function  Topic is solved

Posted: 26 Mar 2018, 05:26
by lexikos
Hotstring() was added in v1.1.28 and partially added (but broken) in v2.0-a089. It's fixed in v2.0-a90.