Arduino (1) Bugs (3) C (1) Install (3) Linux (25) Maths (1) Python (11) Raspberry Pi (4)

Saturday, 17 September 2016

Simulating your mouse

Sometimes you just want to automate tasks but the program only has a GUI. Simulating mouse clicks can make this job a lot easier and this is were xdotool comes in.

Installing xdotool:

Debian systems:

sudo apt-get install xdotool


sudo yum install xdotool

Arch linux:

sudo pacman -S xdotool

Simulating mouse movements and clicks

Left click

xdotool click 1

Right click

xdotool click 2

Mouse move

xdotool XXX YYY (XXX,YYY Being the coordinates)

A basic example where this can be used is a online dogeminer click game.

#Simple Auto clicker
while [ 1 ];do
  xdotool mousemove XXX YYY click 1
  sleep 5