Lurker News
Hello HN,

this is the first functional reimplementation of AutoHotkey [1] for Unix-like systems, as far as I am aware. Half the commands are still missing, but everything important is done, as I have worked a lot on it over the past two months. Converting scripts into stand alone binaries is also supported. Hope this will find some adoption eventually. :-) - This implementation focuses on v1.0-like classic syntax from 2004 (!). This is a significant subset of the popular current v1.1 syntax from Windows (AHK_L). The reason this does not (yet?) target the full Windows spec is how complex it is. Notably, there's also another ongoing project which targets v2 called KeySharp [2].
If you are not aware of what AHK is, it is an easy but capable scripting language for automation and Hotkeys, and all sorts of visual things like GUIs.
If you want to learn more, there plenty of info on the repo, the docs html, and there's an active AHK Discord too, and I am personally also checking the forums and HN of course.
[1] https://www.autohotkey.com/ [2] https://bitbucket.org/mfeemster/keysharp/

Comments (183) 43 threads

Show all comments

Showing thread 33 of 43

jrm41 reply#
Advantages over xbindkeys?
squeaky-clean2 replies#
I don't use xbindkeys so maybe my impression is wrong, but AHK is far more powerful. You can incorporate state into your scripts, or read things from the screen and act conditially on it (though the repo says WindowSpy is unsupported. I think that's what allowed screen-reading).

You can compile it into a binary with no dependencies, so you can easily bring your script to other computers or share it. You can create a GUI to run commands rather than binding them to key patterns.
I used to use it in World of Warcraft to do things like have my character's entire skill rotation on one key (e.g. just keep pressing "1" and AHK will handle pressing the next "real" key for the sequence. Hit another key and I can reset the sequence early). And to automatically tatget myself and cast a heal when my health goes below 50%, which was done by polling a certain pixel on the screen for a specific value of red.

A4ET8a8uTh02 replies#
Absolute level of awesome ( even though some companies do clamp down hard on features like these for a variety of reasons ). Have you tried offering those scripts to players? I am more than certain that most MMOs would have loved to use them.
jabroni_salad#
Blizzard does ban for autohotkey, and even stuff like gaming keyboard macros.
squeaky-clean#
Sorry :p this was way-way back in vanilla days, before I took backing up my code seriously.

I actually had a way more advanced, but very buggy script I used for "multi boxing", which is when you pay for multiple accounts and play them simultaneously. I used WASD, TFGH, IJKL, for moving 3 characters simultaneously, the numpad for targeting, and ctrl/shift/alt + number-row for casting spells on any of the windows. So ctrl+2 would cast the warrior 2nd ability, shift+alt+4 would cast the druid and mage 4th ability, ctrl+shift+alt+2 would cast all character's 2nd ability, etc.
Blizzard used to be a lot more lax about macros[0], and they liked multiboxing because it was more money. I had a GM message me once to confirm I was playing all 3 and not afk botting. We chatted about AHK and how he wanted to learn to code.
[0] also the tools to detect macros were way worse back then, it might have been that they just accepted it rather than actually embracing it.

amelius2 replies#
I'm wondering, why introduce a new scripting language; wouldn't it make more sense to release it as e.g. a Python library? Or something that you can script with Bash?
squeaky-clean1 reply#
Well this was back in the Python 2.4 days, I don't think I had even heard of it. And bash isn't easily available on Windows, at least interacting with running win32 programs. Back then it was even worse, I think I used mingw32 when I needed that? Blizzard did offer some sort of official macro system using Lua, but that was a bit advanced for me at the time.

A dedicated language is nice because the syntax can be optimized for its purpose. As a teen with little coding experience, AHK was so easy to get simple ideas working. Often one easy line of code.
Some of the bigger monstrosities I wrote would have definitely been more manageable in another language, but then I'd have to handle always-active input listening, window management, emulating the keyboard and cursor, reading screen pixels, my own state machine for key chording, and so on. Or cobble together libraries (and still learn those).
Also probably the most important part, it was fun to work with and immediate. I wasn't a professional (or even good) programmer. But I had a goal in mind and AHK never made me want to quit.

Continue this thread — 1 reply

selfhoster11#
AHK is fairly well established in its niche, so not a new language by any stretch. That's even before you get to the complexity of Python or Bash vs a dedicated DSL.