Any macro recorder programs availiable?

Is there any macro recorders for ubuntu? I want a program that i could assign a key to do a recorded mouse movement and keyboard typing. Thanks


Take a look at Gnu - Xnee

Link: http://www.gnu.org/software/xnee/

For the command line application on ubuntu:

sudo apt-get install cnee

N.B: xnee is a meta package in ubuntu and installing that will also install cnee. gnee is the package you should install if you want a gui.

Example usage:

cnee --record -o events.xnr --mouse --events-to-record 100 --time 2

This records 100 mouse events after a delay of 2 seconds.

cnee --replay -f events.xnr --time 2

This playbacks the events after a delay of 2 seconds.

I would look at the man page for cnee for more details about how to use it.

Also more details about xnee can be found here https://xnee.wordpress.com/


Actiona is not a recorder, it's a task automation tool. After getting errors with gnee I tried it and I think it's a great tool and easy to use.

sudo apt install actiona

Instead of recording a macro, it might be more useful to script it from scratch with xdotool. It gives you far more control over the process.

From your description, I assume that you need something more permanent and not a macro that is only used a few times after recording it. I know this may not be what you are wishing for but it may be the best solution.

A recorded macro would fail with missing windows, different window sizes etc. as it is blind to its environment. I doubt that is acceptable in your case.

With xdotool could identify windows and manipulate them to your parameters, and then program clicks relative to them, ignoring their position.

You can even execute commands from within a pure xdotool script and close their window after the job is done.

sudo apt install xdotool

To get the right position for your clicks you can move your window into the top left corner and use:

ALT+F2
xterm -hold -e /usr/bin/xdotool getmouselocation

Keep in mind that on Ubuntu you usually cannot move your window to the coordinates 0,0. You would have to calculate the offset.

Create a text file for your xdotool script. Let's call it xdoscript.

This is a sample script for xdotool:

search --name xdowindow
windowfocus
windowsize 1000 800
mousemove --window %@ 200 100
click 3
sleep 2
mousemove --window %@ 400 200
click 1
sleep 1
click 3
mousemove_relative --polar 140 5
sleep 1
click 1
sleep 1
type "man xdotool"
sleep 2
key Return
sleep 2
key Next
sleep 1
key Next
sleep 1
key Next
sleep 1
key q

I tried to get this working with gnome-terminal but gnome-terminal has been a major failure for some time and since then its window title cannot be changed, so I used Sakura for testing instead. The sleep commands are just to slow it down to a watchable speed.

sudo apt install sakura

Start Sakura with the custom name xdowindow and start the xdotool script in it:

sakura -t xdowindow
xdotool xdoscript   

For your own script you would need the following:

  • the window title
  • the window id (only if your window title is not unique)
  • a defined window size (if click points change with different sizes)

Of course, although such scripts are much more robust than recorded macros, they are by no means portable. If you change your desktop settings such as font size or reinstall your system, they might stop working and would require adjustment.

PS: The windowfocus command is required for most other commands to work.