Skip to content

Instantly share code, notes, and snippets.

@cyrillbrito
Last active March 31, 2018 18:37
Show Gist options
  • Save cyrillbrito/fd961830d01d88124d3ce69982b3ed1d to your computer and use it in GitHub Desktop.
Save cyrillbrito/fd961830d01d88124d3ce69982b3ed1d to your computer and use it in GitHub Desktop.
scripts using xdotool to automate something.

xdotool

This is a list of bash scripts using xdotool to automate something.

#!/bin/bash
while [ 1 -lt 2 ]; do
xdotool click 1
done
#!/bin/bash
function vote
{
# Move to email
sleep 1
xdotool mousemove 1020 105
# Select email
sleep 1
xdotool click 1
xdotool click 1
xdotool click 1
# Copy email
sleep 1
xdotool key ctrl+c
# Delete email
sleep 1
xdotool key Delete
xdotool key Delete
# Move to vote
sleep 1
xdotool mousemove 700 600
#xdotool mousemove 350 600
# Click vote
sleep 1
xdotool click 1
# Move to textbox
sleep 1
xdotool mousemove 520 620
# Select textbox
sleep 1
xdotool click 1
xdotool click 1
xdotool click 1
# Delete old email
sleep 1
xdotool key Delete
# Paste email
sleep 1
xdotool key ctrl+v
# Move to confirmar
sleep 1
xdotool mousemove 520 660
# Click confirmar
sleep 1
xdotool click 1+
# Move to close
sleep 3
xdotool mousemove 700 480
# Click to close
sleep 1
xdotool click 1
}
while true; do
reps=$[ ( $RANDOM % 25 ) + 1 ]
echo "-> Doing $reps votes"
for ((i=1 ; i <= reps; i++))
do
echo "Vote $i"
vote
done
wtime=$[ ( $RANDOM % 60 ) + 1 ]
echo "-> Waiting for $wtime minutes"
for ((i=1 ; i <= wtime; i++))
do
echo "Minute $i"
sleep 60
done
done
#!/bin/bash
xdotool keydown Pointer_Button1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment