AutoHotkey V2: dynamic hotstrings with regex

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
frabjous
Posts: 10
Joined: 30 Mar 2014, 16:44

AutoHotkey V2: dynamic hotstrings with regex

Post by frabjous » 05 Feb 2023, 10:43

In the light of the recent announcement that V1 is "deprecated", I am trying to move to V2. But I have some useful dynamic hotstrings (using regex) which depend on "#Include Hotstring.ahk", using the file at https://github.com/menixator/hotstring. (There is another such script, which I think achieves something similar, at https://www.autohotkey.com/board/topic/114764-regex-dynamic-hotstrings/)
But is there anything compatible with V2 which has this functionality? I would try to update it myself if I understood it!
Many thanks!

User avatar
mikeyww
Posts: 27096
Joined: 09 Sep 2014, 18:38

Re: AutoHotkey V2: dynamic hotstrings with regex

Post by mikeyww » 05 Feb 2023, 10:53

I'm not sure, but if you are starting to code in v2, you can probably convert the first one yourself. The script is short.

HasKey becomes Has.
Count() becomes Length for arrays.
Use the "&" syntax in RegExMatch, which now returns objects instead of pseudoarrays.
IsUpper instead of upper.

When you finish, you will know a lot more about v2, so your future coding will proceed more quickly.

You can then also post the result for others to use. :)

gregster
Posts: 9067
Joined: 30 Sep 2013, 06:48

Re: AutoHotkey V2: dynamic hotstrings with regex

Post by gregster » 05 Feb 2023, 10:58

Haven't tried it, but there is also viewtopic.php?f=83&t=104637&p=505789#p464798
But you can use v1 along with v2...

Post Reply

Return to “Ask for Help (v2)”