Ask HN: Any good alternative to AHK?
Got this little AHK script that got bigger overtime. It's a price checker tool for a game called Path of Exile:
https://github.com/thirdy/trademacro
Where it:
1. activates on clipboard copy event 2. parses clipboard data 3. do a POST request 4. web scrape the result 5. format and output into a tooltip
AHK is great bec:
1. Very easy to use, just like javascript, you only need a notepad and run it right away 2. It has solid support for defining hotkeys. 3. Easy tooltip, but it gets messy beyond simple ones. 4. Small runtime, a few megabytes. This is good since users are non-programmers who don't want installing stuff. 5. Easy for non-programmers to contribute since it's very simple for making macro scripts. Not a must, but good to have.
While AHK is okay, the code gets messy fast and hard to debug if you do not know all the language rules and best practices.
I would like to ask if there's something else I can go for? Have an easier life, statically typed, lots of compiler checks (in AHK, if you got something wrong, goodluck!). I think [jnativehook](https://github.com/kwhat/jnativehook), is one good route. Now I just have to find the right scripting language and package java as self extracting 16mb 7zip. ```
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener; public class GlobalKeyListenerExample implements NativeKeyListener {
public void nativeKeyPressed(NativeKeyEvent e) {}
public void nativeKeyReleased(NativeKeyEvent e) {}
public void nativeKeyTyped(NativeKeyEvent e) {
System.out.println("Key Typed: " + e.getKeyText(e.getKeyCode()));
}
}
``` public static void main(String[] args) throws NativeHookException {
GlobalScreen.registerNativeHook();
GlobalScreen.addNativeKeyListener(new GlobalKeyListenerExample());
}