Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #This script REQUIRES xdotool. Naturally, it only works on Linux/Unix.
- #NO WARRANTY IS GIVEN WHATSOEVER. DESPITE SUCCESSFUL SAFETY TESTS, USE AT YOUR OWN RISK.
- #Customize by setting the next line
- MAX_DIFF=20
- echo "Position the mouse (do not click) and press ENTER..."
- echo "When you're done, move the mouse away from the starting point"
- read
- X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
- Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
- MIN_X=$(expr $X - $MAX_DIFF)
- MAX_X=$(expr $X + $MAX_DIFF)
- MIN_Y=$(expr $Y - $MAX_DIFF)
- MAX_Y=$(expr $Y + $MAX_DIFF)
- echo "$MIN_X,$MIN_Y $MAX_X,$MAX_Y"
- xdotool click 1
- while
- expr $X '>=' $MIN_X '&' $X '<=' $MAX_X '&' $Y '>=' $MIN_Y '&' $Y '<=' $MAX_Y
- do
- xdotool type "qwertyuiopasdfghjklzxcvbnm1234567890 "
- X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
- Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
- done
- echo "The mouse moved out of bounds. STOPPED."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement