Skip to content

Instantly share code, notes, and snippets.

@RayBB
Created November 4, 2018 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RayBB/3b713a4be9d8cd4a9e8fc0c0f9147c05 to your computer and use it in GitHub Desktop.
Save RayBB/3b713a4be9d8cd4a9e8fc0c0f9147c05 to your computer and use it in GitHub Desktop.
Automatically clicks stuff
#!/bin/sh
# Usage: ./onePlusClicker.sh 15
# a simple tool to automate clicking. Script takes # of clicks (which will be multiplied by ClicksPerLoop) as an argument
# You must set the following 5 variables for your computer before running
# The first four numbers are to set the bounds of where the program should click
# ClicksPerLoop is how many times it will click on each random spot generated
XMIN=550
XMAX=810
YMIN=260
YMAX=600
ClicksPerLoop=10
echo $1
echo $(date)
for (( i = 1; i <= $1; i++ ))
do
X=$(( ( RANDOM % ($XMAX-$XMIN) ) + $XMIN ))
Y=$(( ( RANDOM % ($YMAX-$YMIN) ) + $YMIN ))
# By default the delay is for up to 1000 miliseconds
DELAY=$(printf "0.%04d\n" $(( RANDOM % 1000 )))
xdotool mousemove $X $Y \
click --repeat $ClicksPerLoop 1
echo -en "\r$i";
sleep $DELAY
# Refreshes the webpage every 100 loops
if [ $(($i%100)) = 0 ]; then
xdotool key F5
sleep 2
fi
done
echo " loops completed with $ClicksPerLoop clicks per loop"
echo $(date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment