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/

  • After installation the ubuntu 15 give me an system error. – Tara Nickos Mar 31 '16 at 15:21
  • @TaraNickos : I updated the answer with some more details which might help – Anurag Soni Mar 31 '16 at 16:38
  • 1
    tried everything you wrote. It does not works. Thanks so much for your time but i really cannot understand why there is not any alternatine program. There are so many for windows. Why only 1 for ubuntu? – Tara Nickos Apr 1 '16 at 17:21
  • Ironically enough, gnee doesn't seem to install a .desktop file lol. – wheeler Jun 1 at 18:29

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
  • I had issues with getting Actiona to press on launcher icons on the side dock in Ubuntu. – wheeler Jun 1 at 19:00

You can use X-Macro.

To install x-Macro use this command:

sudo apt-get install xmacro

For record use xmacrorec2 command:

xmacrorec2 > test.file

for play recorded macro use xmacroplay

xmacroplay "$DISPLAY" < test.file

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.

The best out there is Sikuli

sudo apt-get install sikulix

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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