Script your Mouse/X-Input Devices in Linux

28 May

Actually for a stupid flash game on facebook I was searching for a way to script mouse-movement and clicks on linus/

Happily, I found a tool that does exactly what I wanted:
It’s called “X Do Tool” or short xdotool . A simple make did it for me and I had my script ready.

First I tried to do clicking by

./xdotool mousedown 1 ; ./xdotool mouseup 1

( 1 is left, 2 middle, 3 right mouse button, according to your xorg.conf ), but then I found that a simple ./xdotool click 1 would also do it;

So for “cheating” at this stupid “who can click the most times in 30 seconds” game on facebook, simply open a console next to your browser, type

while true; do xdotool click 1; done

and depending on the speed of your x-server you get far more than 1000 clicks / 30 seconds. sadly they have some manipulation detection or something like that so you would have to add some “sleep xx” calls to your loop 😉

I’ve stopped playing around this while having reached around 480 clicks, being placed second after an aquaintance of mine.

Happy “cheating” 😀

Comment Form