Problem
Am looking to automatically move the mouse cursor and simulate mouse button clicks from the command-line using an external script. Am not looking to:
- Record mouse movement and playback (e.g., xnee, xmacro)
- Instantly move the mouse from one location to another (e.g., xdotool, Python's warp_pointer)
Ideal Solution
What I'd like to do is the following:
- Edit a simple script file (e.g.,
mouse-script.txt
). - Add a list of coordinates, movement speeds, delays, and button clicks. For example:
(x, y, rate) = (500, 500, 50) sleep = 5 click = left
- Run the script:
xsim < mouse-script.txt
.
Question
How do you automate mouse movement so that it transitions from its current location to another spot on the screen, at a specific velocity? For example:
xdotool mousemove 500 500 --rate 50
The --rate 50
doesn't exist with xdotool
.
xaut
for PythonREADME
instructionssrc/Makefile
CFLAGS
line as follows:/usr/local/src/xaut-0.2.0/python/build/lib/*
to a new directory.mm.py
:on newer versions of Ubuntu (14.04+), you can use Autopilot, a UI testing tool for Ubuntu. It is made for creating and running user interface tests, but can also be used for basic GUI automation tasks.
to install:
an example script (Python3) to automate mouse movement:
You would run this just like any other Python3 script. Watch your mouse pointer move!