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

Autohotkey is amazing, but I wish it used a saner language. I struggled to write a reliable golden ratio version of aero snap [1]. Dealing with different monitors, sizes, etc doesn't seem like it should be so hard, but I always get tripped up by the bizarre Loop syntax or silent failures from some simple mistake that suck the fun out and I give up.

I found ahk python module [2] but combining it with the keyboard module doesn't work as well as autohotkey as a hotkey listener.

[1]: https://github.com/idbrii/daveconfig/blob/main/win/autohotke... [2]: https://pypi.org/project/ahk/




That's why Autohotkey v2 exists, which is... AHK's own Python3 moment, since it was available for years. Well, ok, stable release was only like a year ago, but I don't see much adoption.


TFA uses V2. I also started using AHK just in time to use V2. Of course it will take time for all the V1 users to migrate, but for anyone starting now it makes little sense to use V1.


I believe I’m using v2, since I written most of my scripts last year by most recent documentation which mentioned “old ways” sometimes. But it didn’t make a big difference in that regard.


Couple of ways to tell

1. Do your multiline hotkeys have `Return` in them, or are they in braces?

2. Do you write `Send Foo` or `Send "Foo"`?

If you're doing the former, then I really recommend upgrading to v2, it makes a huge difference.


I think the former. Thanks, I’ll look into it!


Part of the problem IMO is that AHKv2 is magnitudes better if you're a programmer, because it makes the entire language consistent and sane. But if most users aren't programmers, so they don't have the same burning incentive to switch.


it's just a bit tedious to convert even with the help of a converter, especially when you're dealing with libraries which you didn't write, but still very much worth it (you could maybe also do a lot of the conversion piecemeal and just run both for some time)


You know, that's part of what's been holding me back from using it for much besides remapping CapsLock to Control. Maybe it's time to sit down and write a Lisp DSL that compiles to it.


Or make it call a cloud service running a real program in a kubernetes cluster, which gets the hotkey and returns a script to interpret. If AutoHotKey does not have network and eval functions, they must be added ASAP

:-)


Remapping Capslock to Control:

Windows: https://github.com/randyrants/sharpkeys

Ubuntu Linux (don't know about other Linuxes): /usr/share/X11/xkb/symbols/pc

    key <CAPS> { [ Caps_Lock  ] };
->

    key <CAPS> { [ Control_L  ] };
These solutions avoid needing to keep a keybinding application open. The Linux solution unfortunately resets after every version upgrade.


It's always time to sit down and write a lisp DSL. That compiles itself to AutoHotKey scripts so you can compile while you key.

(I am in the process of doing this inside OpenSCAD.)


Indeed, that's the biggest issue with AHK, though v2 helps a lot in this regard.

Dreams of a universal hotkey listener you could use in any language via some wasm plugin magic?




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

Search: