This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REGION_X=2928 | |
REGION_Y=507 | |
REGION_W=864 | |
REGION_H=1220 | |
WIN_MID_X=3200 | |
WIN_MID_Y=1000 | |
HASH_PREV=1 | |
HASH_PREVPREV=2 | |
FILE_PREV= | |
xdotool mousemove $WIN_MID_X $WIN_MID_Y | |
xdotool mousedown 1 | |
sleep 1 | |
echo Ready | |
for i in $(seq 1000); do | |
FILE=$(printf "%03d.png" "$i") | |
import -window root -crop "${REGION_W}x${REGION_H}+${REGION_X}+${REGION_Y}" "$FILE" | |
sleep 0.2 | |
HASH=$(imagehash "$FILE") | |
echo "$FILE -- $HASH" | |
if [ "$HASH" = "$HASH_PREV" -a "$HASH" = "$HASH_PREVPREV" ]; then | |
echo "Finished" | |
rm "$FILE" | |
rm "$FILE_PREV" | |
exit | |
else | |
HASH_PREVPREV=$HASH_PREV | |
HASH_PREV=$HASH | |
FILE_PREV=$FILE | |
fi | |
xdotool mousemove $WIN_MID_X $WIN_MID_Y | |
xdotool mousedown 1 | |
xdotool key Left | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment