Then there's also AHK's ease of use, which also makes it appealing to non-programmers or beginners. Every piece of logic (even loops etc) is basically encapsulated in a single-word command instruction, almost like ASM, but for humans. You create GUIs with `Gui, add, button`, maximize windows with `WinMaximize Firefox`, hotkeys with `a::MsgBox You pressed a` and so on, and all of that with basically no code. I'd recommend you take a short look at the AHK documentation, such as the intro or alphabetical list of commands. It gives you an idea of what you can do with it.
Besides, the entire language is visually oriented (and so is this implementation of mine): You create, edit, run, reload, and (optionally) compile scripts usually not by using terminal, but by context menus. This makes it far more accessible for people migrating from Windows, apart from the fact that you can apply your acquired AHK skills from Windows.
Finally, I have found that the existing Linux automation-specific tools (which mostly boils down to xdotool) are, in comparison to Windows AHK, inferior. Getting Windows-like automation functionality on Linux is quite a task. The main difference is that very often, you just don't need Window or Hotkey automation on Linux, because most programs are CLI-first, thankfully.
It shows a failure of the "Unix Way" imo. Everyone hand-rolling their homebrew combination of 20 different tools together is sometimes not the best way to go.
We can look at Docker, Kubernetes, Dropbox(etc), desktop environments, and many other things to see that people greatly value almost the complete opposite approach, within some sweet-spot.
The reason that no nontrivial popular program exists written using shell scripts is because the Unix Way of gluing together separate programs just isn't a sustainable software development methodology that leads to nontrivial useful software.
You can create simple GUIs straight from bash too - take a look at zenity (I'm aware it's not the only option BTW)
1. Move cursor to the toolbar icon of an app, right click, navigate menus, and select an option (all with one keystroke).
2. Click a button in one program. Copy file. Switch to Excel. Switch to the right worksheet. Click a VBA button. Switch to another sheet. All with one keystroke.
3. With one keystroke, set certain settings in Visual Studio (via the menu) and run the debugger.
4. With a keystroke, sign out of Teams/Skype.
5. Launch screenshot program, present me with a dialog box asking for filename, and have it save the screenshot in a directory and provide me an Org-mode link to the saved file.
These are all "easy" in AHK. I never learned it well enough to do more advanced stuff.
It kind of makes sense then that this was made for and got popular on windows, because that OS is absolutely rife with annoying gui software written for the lowest common denominator of user.
Whenever i infrequently have to use windows I'm a bit shocked at the number of clicks you need to get anything done.
1. Press Ctrl P to get to the Print dialog 2. Scroll to "Print Using System Dialog" 3. Click on Page Setup. 4. Select 2 Pages per side. 5. Choose "Letter" for Paper Size 6. Click on "Print"
I can automate this using AHK on Windows. How would you do it on Linux? And how is running Firefox on Linux helping me any more than Windows?
How do you trigger the behavior? Is it bound to a key or is there a different way to trigger the action?
For example, I'm an emacs user and though I remember a lot of bindings, I also use heavily helm-M-x which provides fuzzy completion on command name.
For example, I may not remember all org-mode shortcuts, but I can do:
M-x org subtree
And I'll get a list of all org-mode commands on subtrees.
(I've never used AHK.)
How exactly does this work? Are you just sending a bunch of shortcuts? Or does autohotkey really understand when it reached "Print Using System Dialog" and which button has "Page Setup"?
That's like saying shellscripts prime utility seems like hacking optimizations on inefficient-for-power-users cli software. Every poweruser has always demand for automation, independent of the interface, software and OS.
> because that OS is absolutely rife with annoying gui software written for the lowest common denominator of user.
And yet, Linux is even worse in that regard.
That may be true of AutoHotKey on Windows but we're talking about a Linux port here where some of the features straight up don't work or don't add anything that didn't already exist in Linux.
> xdotool doesn't do hotkeys itself, and doesn't work well being run with hotkeys involving modifiers
It doesn't do those things because it doesn't need to on any version of KDE or Gnome (or probably anything else) since about 1998, possibly earlier though my memory gets foggy beyond that point.
> AutoHotKey also does hotstrings (Espanso is the closest Linux equivalent I know, and doesn't work as well IME)
Espanso and AHK probably suffer the same fate, given this line from the AHK for Linux Documentation:
> Hotstrings don't work in some applications. Not sure if this is fixable (help needed!). The only reliable alternative is using Hotkeys.
> app- or window-specific behaviour, and more.
You can absolutely do app- and window-specific things with xdotool. It merely requires adding some steps to detect the window or process, which is identical to AHK's approach if you're just writing scripts.
The best thing this port has going for it is that it has a great UI that people are already familiar with and in spite of its shortcomings as a port it is worth checking out.
I'd love if someone spent the time to develop something like this into a script generator for xdotool that could do things like recording mouse movements, etc.
Maybe a wayland-ized version can support hotstrings and the other warty edge cases that don't work on Linux the way they do on Windows.
AHK would pull up file menu, export menu, select java, type jar filename, hit next, select jar file, confirm overwrite, next, next, select seal the jar, yes overwrite, click that one random dialog button that's bizarrely not hotkey selectable, type main class as 'default.java', next, confirm, click finish. Click confirm again despite finish because GUI. And bam, another JAR file ready to test.
Though not everything can be done with different development tools and AHK is a versatile swiss army knife. It can also do things like hotkey to make any window stay on top, send window resize message to a runaway or disobedient window, or be hotkey window clicks for games. I use it in stormworks to make my own shortcuts to edit / wiring / mirror buttons since they're 54 inches apart, and hopefully this all shows where AHK's versatility shines.
I did use PyUserInput/PyMouse to "play" Universal Paperclips one time on Linux. Similar, though not nearly as featured, to AHK.
https://www.tidbitsfortechs.com/2013/10/using-autohotkey-to-...
Helpful when I'm trying to send inline responses in an otherwise busy thread with multiple colors... and then I can switch back to my default blue after that with the same keystroke
For automation, xdotool is pretty good. xprop and wmctrl are not so user friendly though.
As for keyboard remapping, sxhkd is great, but finding what keys are called requires xev or something like it. xmodmap is not easy for beginners either.
At the very least you have to know what to look for. I'm not an advocate of AHK, but having all those options in the same place would be good.