Advertisement
Guest User

Untitled

a guest
May 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.99 KB | None | 0 0
  1. #!/bin/bash
  2. #This script REQUIRES xdotool. Naturally, it only works on Linux/Unix.
  3. #NO WARRANTY IS GIVEN WHATSOEVER. DESPITE SUCCESSFUL SAFETY TESTS, USE AT YOUR OWN RISK.
  4.  
  5. #Customize by setting the next line
  6. MAX_DIFF=20
  7.  
  8. echo "Position the mouse (do not click) and press ENTER..."
  9. echo "When you're done, move the mouse away from the starting point"
  10. read
  11.  
  12. X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
  13. Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
  14. MIN_X=$(expr $X - $MAX_DIFF)
  15. MAX_X=$(expr $X + $MAX_DIFF)
  16. MIN_Y=$(expr $Y - $MAX_DIFF)
  17. MAX_Y=$(expr $Y + $MAX_DIFF)
  18. echo "$MIN_X,$MIN_Y $MAX_X,$MAX_Y"
  19.  
  20. xdotool click 1
  21.  
  22. while
  23. expr $X '>=' $MIN_X '&' $X '<=' $MAX_X '&' $Y '>=' $MIN_Y '&' $Y '<=' $MAX_Y
  24. do
  25.  
  26. xdotool type "qwertyuiopasdfghjklzxcvbnm1234567890 "
  27. X=$(xdotool getmouselocation | cut -d " " -f 1 | cut -d ":" -f 2)
  28. Y=$(xdotool getmouselocation | cut -d " " -f 2 | cut -d ":" -f 2)
  29.  
  30. done
  31.  
  32. echo "The mouse moved out of bounds. STOPPED."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement