I want to click on something for hours. How can I make a script or use an application so the mouse will auto-click every 5 seconds or less?
Open terminal, install xdotool
sudo apt-get install xdotool
Also, open the window you want to click side by side with terminal. Select terminal (as active window) and move the mouse over the point where you want to click. In terminal type (try not to move the mouse)
You will need the x:XXX and y:YYY (bottom). You can move the mouse from here, but let windows stay where they are. Type
Paste the following on gedit (change the XXX and YYY for the numbers you got before)
#!/bin/bash while [ 1 ]; do xdotool mousemove XXX YYY click 1 & sleep 5 done
Save and close it. Then
chmod +x script
To execute it,
To get less, simply change the 5 after sleep to less.
In Lucid 10.04 LTS
- Open Ubuntu Software Center
- In the search box, type in autoclick
For Precise 12.04LTS the package has been removed from the Ubuntu Repositories and is only available via GetDeb.
or via Christoph Korn's PPA (who is a member of GetDeb):
sudo apt-add-repository ppa:c-korn/ppa
Download xautoclick via the software center (or if you are handy with the terminal)
sudo apt update && sudo apt upgrade && sudo apt install xautoclick
- Read the instructions on xautoclick
- Under Programs, Accesories choose xautoclick
- Change the Interval to 5000 (the value is milliseconds)
- Click Start
- Move the mouse over what you would like to click
To enable the GetDeb repositories:
wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add - sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu precise-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
For even more automation you can use sikuli.
Sikuli has integrated tool that allows you to very simply write any form of interaction (mouse clicking or keyboard) by visual processing where is what on screen.
You simply select where you want your click to occur by visually selecting screen part and off it goes. Automation logic is written in python, but even if you don't have any clue about python you can easily figure it out, because tool provides you with everything right away!
You can simply install it with
sudo apt-get install sikuli-ide.
With xdotool installed: (
apt-get install xdotool (As root or with
This will click in the current mouse position every 5 seconds for 100000 times (That is somewhere between 5 and 6 days...)
xdotool click --delay 5000 --repeat 100000 1 # (assuming the mouse is left where it needs to click).
To click in a specific place: (In a command-line friendly version, for a script you probably want better formatting)
while sleep 5; do xdotool mousemove XXX YYY click 1; done
--repeat can be used on the click here as well, but that won't repeat the move...)