50

Is there an equivalent product/method for AutoHotkey. For those that don't know, its a product that allows you to program your mouse movements and keyboard. This allows me to "macro" certain functions on programs instead of having to do it manually. In the old days they used to call them keyboard stuffers. But that is only half of the solution as I need a "mouse movement" stuffer as well.

Is there such a beast?

31

There's a port of AutoHotKey to Linux called IronAHK and a similar tool called Autokey. I haven't used either, I don't know how well they work.

Other than such programs, you won't find exactly the same kind of automation tools. The basic user automation tool on unix systems is the shell. The shell is the glue that combines other tools: it can launch external programs and control how they exchange data. The shell itself doesn't include anything to manipulate GUI concepts like windows and the mouse pointer¹. What you do is call specialized tools in a shell script, in particular xdotool to manipulate windows, and inject keystrokes and mouse events.

For example, the following script clicks at the position (40,20) in the window of Myapp.

#!/bin/sh
xdotool search --class Myapp \
        mousemove --window %1 40 20 \
        click 1

¹ Except for dtksh, but I've never seen a Linux port of it.

  • Nice summary, pity the project is 4 years out of date and the binaries are all 404's, will give the xdotool a try though. Thanks for taking the time. – Meer Borg Oct 31 '14 at 6:36
  • tried out xdotool, works like a charm but you should definitely read their docs before starting – ConstantineK Sep 16 '16 at 13:59
  • 1
    AFAIK, IronAHK never got fully implemented and has been abandoned. – Joe Aug 1 '19 at 16:07
2

You can use xautomation in Linux. I use it on Raspberry Pi display screens, to send F5 page refreshes and 'Return' (enter) keystrokes for logins.

2

Use AutohotkeyX, it's a recent WINE port of autohotkey which, according to winehq testing, does everything that Autohokey is able to do on windows. It's easily the best and most straightforward answer.

https://appdb.winehq.org/objectManager.php?sClass=version&iId=17738

I haven't personally tested this, but WINEHQ results tend

1

There are several projects that address this. The two most active ones, AFAIK, are sikuli and AutoKey (a project I help support.)

I have not used sikuli, but it appears to be based on finding patterns on the screen and triggering actions based on them.

AutoKey allows the user to define trigger phrases and hotkeys which expand phrases (similar to a very powerful autocorrect feature) or run scripts written in Python3 that are only limited by the user's programming skills. It provides an API for keyboard and mouse event generation. It also integrates with Xautomation which allows you to find a small image on the screen and move the mouse cursor to it.

I have been using AutoKey for many years and supporting it on our list. It's like a number of productivity tools: you can get by without it, but once you start using it, you'll wonder how you ever did without it.

Some specifics:

AutoKey does not work with AutoHotKey definitions and scripts. They will have to be rewritten.

I did write a proof of concept bash script (available upon request) which translates AutoHotKey phrases into AutoKey phrases, but it is only a starting point and ignores most of AutoHotKey's options.

Since AutoKey scripts are written in Python3, it is also possible to call out to tools such as xdotool and wmctrl from within a script to provide additional functionality, but this is typically not necessary. Although AutoKey scripts are written in Python, quite a lot can be accomplished with a very limited knowledge of Python. You don't need to be a fluent Python programmer for most purposes.

If you use a Debian-based distribution, please don't install the version of AutoKey provided by your distribution. Their AutoKey package is unmaintained and very old. Get a current version from us.

0

Download Autohotkey on Linux. Create a Autohotkey file (example.ahk). Use wine to run Ahk2Exe.exe from the Autohotkey folder. Compile your example.ahk file to example.exe Use wine to run example.exe

  • 2
    It's not a good option. For now, the functionality of Autohotkey run through wine is very limited: appdb.winehq.org/…. – banan3'14 Sep 7 '18 at 18:06
0

...program your mouse movements and keyboard. This allows me to "macro" certain functions on programs instead of having to do it manually.

Kantu is a cross-platform desktop automation tool that works very well on Ubuntu (I have not tested it on other flavors)

The basic user automation tool on unix systems is the shell.

Yeah. But AHK and Kantu allow the user to automate task inside an application by simulating mouse clicks and keyboard strokes. The shell can not do this. I use it for for automated tests plus a few productivity hacks.

Of course, you can combine kantu with python or start it directly from the shell.

  • 2
    Jim, if you are affiliated with either of those products that you link to, please note that this site's Help Center has guidelines about Expected Behavior in regards to disclosing your affiliation in your answers. Answers that don't include this are subject to deletion. Thank you! – Jeff Schaller Jul 29 '19 at 12:38
-1

Just use XEV and XMODMAP. SIMPLE and better than dedicated programs or emulating crappy Windows apps. All my LINUX stuff uses scripts to redefine keys and change screen modes and then, when the program is done and exits, set everything back to normal. It's about just as easy to use XMODMAP and make a script as it is to make an AHK script, but with the added bonus of not having to run an emulated Windows app. And for people saying you can't do this or that... WRONG. You can do more from Linux shell than any other OS and you can do everything we're talking about, including moving windows around, and still be using system friendly system commands that are built in!

  • 4
    This answer might, for all I know, be 100% correct and accurate.  However, it would be a lot more useful if it included some examples and / or instructions, or even links to further documentation. – Scott Jul 10 '19 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.