Advertisement
metalx1000

Find image in an image and click it

Jun 18th, 2019
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. sleep 2
  4. import -window root /tmp/screen.png
  5. #pat file created with png2pat
  6. loc="$(visgrep /tmp/screen.png /tmp/pattern.pat)"
  7.  
  8. if [ "$loc" == "" ];then
  9.   echo "Not Found"
  10. else
  11.   x="$(echo $(echo "$loc"|cut -d\  -f1|cut -d\, -f1)+20|bc)"
  12.   echo "x=$x"
  13.  
  14.   y="$(echo $(echo "$loc"|cut -d\  -f1|cut -d\, -f2)+20|bc)"
  15.   echo "y=$y"
  16.  
  17.   xte "mousemove $x $y" "sleep 1" "mouseclick 1"
  18. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement