Description:
GNU Xnee is a suite of programs that can record, replay, and distribute user actions under the X11 window system (Linux graphical user interface). We use this tool to set up and run click simulation macros on Linux images.
Installation
- Open a terminal window from the Desktop
- Update the system repositories:
sudo apt update
(if promped for a password use 00000000)
- Install Xnee
sudo apt install xnee
Recording a mouse macro
- connect a USB mouse to the system
- open the terminal
- open the visualisation and press
Alt + Tabto display the terminal window on top of it - input the following command into the terminal and press
Enterto start recording
cnee --record --mouse -o macro.xns
- once you are done recording your clicks press
Alt + Tabto switch back to the terminal - press
Ctrl + Cto stop the macro recording
Now you have a file called macro.xns that contains the recorded actions in the /home/woojin directory.
Replaying the macro
To replay the we first need to set up a bash script. Follow the next steps to do this:
- open the
/home/woojindirectory - right click and select
Create New.. -> Empty File - chose a name, for example
MacroLoop.sh - right click on the file and open it with Visual Studio Code
- write the following code inside and save the file:
#!/bin/bash
# Infinite loop to replay the macro
keep_running=1
while [ $keep_running -eq 1 ]
do
cnee --replay --file macro.xnl --stop-key q
if [ $? -ne 0 ]; then
keep_running=0
break
fi
sleep 5
done
- make the script executable with the following command in terminal:
chmod +x MacroLoop.sh
- open the terminal
- open the visualisation and press
Alt + Tabto display the terminal window on top of it - input the following command into the terminal and press
Enterto start recording
./MacroLoop.sh
Stopping the macro
By defaul the macro will run in an endless loop. To stop the execution of the macro press Q key. This will stop the execution for 5 seconds. In this time you can either press Alt + Tab to display the terminal window again, and then stop the macro execution with Ctrl + C . If you don’t stop it in these 5 seconds window, the macro will be executed again.