Automating the mouse and keyboard in Linux can be done using xdotool, unlike with AutoIt on windows, more advanced features, such as creating GUIs and stuff, is not available with this tool. You can however activate, resize, and move windows around.
This short introduction will show you how to use the xdotool to automate the mouse by moving it, and performing mouse clicks, as well as setting a delay between the clicks.
As such, Xdotool is a nice alternative to AutoIt for Ubuntu, and other Linux distributions – Scripting the commands is a simple matter of creating a bash script
Automating the Mouse with Xdotool
The tool can either be used directly from the terminal, or you can create a bash script, which have the capability to include more commands. The below command will click with the mouse 50 times, using the left mouse button, and wait 300ms between each click.
xdotool click --repeat 50 --delay 300ms 1
The above will just click with the mouse on its current location, meaning that you should move it where you want to click manually. You can however also move the mouse using the Xdotool.
Moving the Mouse
To move the mouse you can use the mousemove command, which will position the mouse at the supplied x and y coordinates on the screen.
xdotool mousemove 50 50
The --repeat 50 part is what makes the command click multiple times, and the --delay 300ms is what creates the delay between clicks – the default delay between clicks is 100ms if you leave the delay part out – the final part is just a number which represents the mouse button to be clicked.
Mouse Button Numbers