Hacker News new | past | comments | ask | show | jobs | submit login

This is a bit of a PITA for me as most people use AHK to handle shortcuts for komorebi[1], which led to me generating an AHK library[2] to help people write their configs. Turns out every single line of that generated library (not to mention the entire sample config for newcomers) is now invalid syntax in v2.

I'm taking a month off from development while I'm traveling, maybe I'll feel less salty about this when I get back.

The biggest issue right now is that the Run and RunWait commands require strings for the commands to be executed, and AHK v2 has absolutely garbage support for string interpolation.

Honestly I'm not sure if I'll continue supporting AHK or just develop my own sxhkd (swhkd?) and recommend that for users going forward.

[1]: https://github.com/LGUG2Z/komorebi

[2]: https://github.com/LGUG2Z/komorebi/blob/master/komorebic.lib...




I have been coding with v1 for about 15yrs and switched to v2 in a heartbeat.

But I would definitely not recommend converting v1 scripts to v2 if is not absolutely necessary.

You can have both installed and work great with the new launcher that auto selects version based on the #Requires directive.

I would definitely not convert v1 scripts that are longer than 2k lines.

What I have found is that re-writing stuff for v2 is WAY easier than converting.

You might also try the v1 -> v2 converter by dimitri. It is not perfect but does 90% of the work for ya.


As far as string interpolation goes, what's wrong with the format() function? It was already in v1, and hasn't gone anywhere in v2.

https://www.autohotkey.com/docs/v1/lib/Format.htm

https://www.autohotkey.com/docs/v2/lib/Format.htm


Tried this but it didn't work as the first arg to Run or RunWait :/


Works fine for me?

v1

    RunWait, % format("{}.exe", "notepad")
v2

    RunWait(format("{}.exe", "notepad"))


Appreciate this, I will take another stab now that I have a working example!


Can you just specify AHK1 for users for the time being? Is there an equivalent of a shebang, differentiator, or something in AHK scripts that'd allow a simultaneous v1 and v2 install? When Python went from 2.x to 3.0, there wasn't some expectation that all adoption of breaking changes happen immediately - one hopes similar provisions have been made here.


we have the #Requires directive

e.g.: #Requires Autohotkey v1.1.36+ 32-Bit

When you install v2 it has a launcher that can be configured and runs scripts with the correct interpreter based on that directive.

If that directive is not in the script it would try to determine the version based on syntax. And if it couldnt determine it, it would ask you what to do.

I have both versions installed and have had no issues as of yet.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: