Live data from Hacker News

AutoHotKey V2 (Breaking Upgrade)

autohotkey.com

31–40 of 124 posts

Re: AutoHotKey V2 (Breaking Upgrade)

#31
post #5
post #4

As someone who recently dove back into AHK, I must say v2 has been fantastic! So many great quality of life improvements and overall the documentation is top notch. I cobbled together a launcher app and modal-hotkey system from scratch in a couple of afternoons of enjoyable work. If you're looking to try stuff out, having an autoreload function is a very nice addition to your script while developing. A very pragmatic…

Is the modal hotkey system public code?

Here's what I got. It's still pretty thrown together but hopefully it's helpful for ideas at least: https://github.com/url00/ModalAHK

Re: AutoHotKey V2 (Breaking Upgrade)

#32
post #13

AHK is what keeps me on Windows

I was a Windows guy: And when I moved to Linux I made some notes that I might have problems because of: AutoCAD - true Photoshop - true SketchUp - true AHK - not so much. Autokey does what I need. But I still have great time for AHK - which is why I looked at this thread. Yeah, there's GIMP and Blender and SU online but these applications were really ace on Windows. I found a way to live without them all.

> I found a way to live without them all.

I'm not willing to sacrifice my productivity for some ideological purity.

It would take weeks to create a fraction of what AHK already does for me with scripts I have improved every year.

I tried to explain in another thread some of the remappings I have: like how Caps often ends us remapped to Esc (when alone) or Control (in conjunction with another key: act as a modifier) on MacOS, my 2 shifts and 2 alt do their normal modifier function (when used in conjunction with another key) but when used by themselves act as PageUp/PageDown Home/End

Going up 2 pages up in the browser? The left shift pressed twice (Shift Shift) gives me 2 PageUp. Top of the page? Alt gives me Home. Bottom? The other Alt gives me End. Select from the point of edition to the beginning? Shift+Alt does Shift + Home. It's not the homerow, but it's 2 keys easy to reach, and never missing (unlike the actual PageUp which is often Fn + something - no I don't want to turn that into 3 or 4 keys).

Yes, doing Cap s=> Esc or Control is possible on Linux, but the rest will be complicated.

And it's just one of the many things AHK does for me! Here's another example: a partial screenshot into a base64 encoded PNG is just 2 keys away.

It might be possible to do all that on Linux, but last time I tried to get something a fraction as good as mintty (with ligatures, italic, sixels...) the best I could get was a pimped xterm.

For what I do, the tooling is just much better on Windows - and yes, you may not believe it, but even for tty/console things.

Re: AutoHotKey V2 (Breaking Upgrade)

#33
post #29
post #16

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…

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 :/

Re: AutoHotKey V2 (Breaking Upgrade)

#34
post #9
post #6

> > Nested Functions > One function may be defined inside another. A nested function may automatically "capture" non-static local variables from the enclosing function (under the right conditions), allowing them to be used after the enclosing function returns. That sounds like a closure. I expected “nested” to mean that the function is defined inside another function but doesn’t capture anything, like what you can do…

Well, C++ has lambdas with explicit capture list. A captureless lambda is basically a function (it even converts to a function pointer), otherwise it's a closure.

Well, what? My objection is calling a closure for “nested function”, a term I’ve never seen for such a thing.

Re: AutoHotKey V2 (Breaking Upgrade)

#35
post #33
post #29

Earlier quoted context omitted.

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"))

Re: AutoHotKey V2 (Breaking Upgrade)

#36
post #9

Earlier quoted context omitted.

Well, C++ has lambdas with explicit capture list. A captureless lambda is basically a function (it even converts to a function pointer), otherwise it's a closure.

Well, what? My objection is calling a closure for “nested function”, a term I’ve never seen for such a thing.

I've seen nested function, whether or not it is also a closure, for ever; a closure is a function with an associated environment; a nested function is a function defined within another function.

Re: AutoHotKey V2 (Breaking Upgrade)

#37
post #35
post #33

Earlier quoted context omitted.

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!

Re: AutoHotKey V2 (Breaking Upgrade)

#38
I've already ported my AHK script to v2, and it was mostly painless. It helps to use VS Code with the extension so that it can highlight what syntax would fail (mostly). Most of it was trivial like adding surrounding quote around `Send` function's param, as well as prepending `#HotIf` in front of WinActive(). As an added benefit, my dual function key is more reliable, ie sending capslock/control as escape or ctrl. (See last entry in https://www.autohotkey.com/boards/viewtopic.php?t=92738)

Re: AutoHotKey V2 (Breaking Upgrade)

#39
post #19

AHK has the distinction of being an absolutely indispensible tool and a horrendously terribly designed language. It's probably the worst-designed programming language I've ever seen. Whenever I'm frustarted with how slow and conservative Python development is, I remind myself that this is the main thing keeping us from reaching the same state as AHK. I hope that this upgrade will fix some of these problems. I'll prob…

> It's probably the worst-designed programming language I've ever seen. I always wonder in these discussions why bourne shell/bash gets a pass. Many people know it, but are somehow blind to how terrible it is.

Probably not a lot of overlap between people who use AHK regularly and people who know shell well enough to be confident that it's a bad language and not just something they aren't used to.

Re: AutoHotKey V2 (Breaking Upgrade)

#40

I like AHK very much but its scripting language is difficult to use of you do not use it often. The most complicated pay for me are braces and delimiters: I never know when to use a brace, when to use style #-delimiters (#HotIf for instance), when a mineral is enough, etc. It would be much better if there was a decision to be homogenous and always require braces, or newlines or whatever - but always the same thing.

I personally use AutoIt a ton as a super fast way to quickly prototype GUIs. It's basically a really simple entrypoint for WinAPI. Shameless plug: my script for emulating a trackball with your keyboard [0], and my tray app for quickly tweaking your cursor speed (usually for when I'm drawing something)[1] There are also some really useful utility apps like WhyNotWin11[2] that's made entirely using AutoIt [0] https://g…

The problem with AutoIt is it's openly hostile community.

What community it does have is extremely and openly hostile towards newbies and non-programmers. To the point where browsing their forums has become a huge turn-off, and definitely has rejected folks trying to learn programming and/or AutoIt.

Even experienced programmers sometimes ask "dumb" questions... and the hostility they're met with is unacceptable.

Post reply on HN