mirror of
https://github.com/bspeice/libcvautomation
synced 2024-12-04 13:58:11 -05:00
Fix error handling if TOLERANCE is not specified
This commit is contained in:
parent
5aedb9e125
commit
71c2a843ac
@ -27,6 +27,8 @@
|
|||||||
CVAMATCH=`which cva-match` || echo "Could not find the cva-match program..." &>2 #Needed for image recognition
|
CVAMATCH=`which cva-match` || echo "Could not find the cva-match program..." &>2 #Needed for image recognition
|
||||||
CVAINPUT=`which cva-input` || echo "Could not find the cva-input program..." &>2 #Needed to manipulate mouse and keyboard
|
CVAINPUT=`which cva-input` || echo "Could not find the cva-input program..." &>2 #Needed to manipulate mouse and keyboard
|
||||||
|
|
||||||
|
INT_MAX=2147483647
|
||||||
|
|
||||||
#Some program-wide configs
|
#Some program-wide configs
|
||||||
SEARCH_METHOD=0 #CV_TM_SQDIFF
|
SEARCH_METHOD=0 #CV_TM_SQDIFF
|
||||||
TOLERANCE=2250000
|
TOLERANCE=2250000
|
||||||
@ -210,6 +212,9 @@ click_i ()
|
|||||||
TOLERANCE_OPTION="-t"
|
TOLERANCE_OPTION="-t"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$TOLERANCE" ]; then
|
||||||
|
TOLERANCE=$INT_MAX
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$USE_WAIT" ]; then
|
if [ -n "$USE_WAIT" ]; then
|
||||||
#Alternate between each image until a match is found, or we loop $TIMEOUT times
|
#Alternate between each image until a match is found, or we loop $TIMEOUT times
|
||||||
@ -390,6 +395,11 @@ image_location ()
|
|||||||
else
|
else
|
||||||
TOLERANCE_OPTION="-t"
|
TOLERANCE_OPTION="-t"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$TOLERANCE" ]; then
|
||||||
|
TOLERANCE=$INT_MAX
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$USE_CENTER" ]; then
|
if [ -n "$USE_CENTER" ]; then
|
||||||
CENTER="--center"
|
CENTER="--center"
|
||||||
else
|
else
|
||||||
@ -507,7 +517,9 @@ hover_i ()
|
|||||||
else
|
else
|
||||||
TOLERANCE_OPTION="-t"
|
TOLERANCE_OPTION="-t"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$TOLERANCE" ]; then
|
||||||
|
TOLERANCE=$INT_MAX
|
||||||
|
fi
|
||||||
if [ -n "$USE_WAIT" ]; then
|
if [ -n "$USE_WAIT" ]; then
|
||||||
#Alternate between each image until a match is found, or we loop $TIMEOUT times
|
#Alternate between each image until a match is found, or we loop $TIMEOUT times
|
||||||
#This is a bit weird, since we need to lower the TIMEOUT value for the "waitfor"
|
#This is a bit weird, since we need to lower the TIMEOUT value for the "waitfor"
|
||||||
@ -726,8 +738,14 @@ waitfor ()
|
|||||||
out "waitfor: $1"
|
out "waitfor: $1"
|
||||||
|
|
||||||
if [ -n "$USE_SANE_TOLERANCE" ]; then
|
if [ -n "$USE_SANE_TOLERANCE" ]; then
|
||||||
|
if [ -z "$TOLERANCE" ]; then
|
||||||
|
TOLERANCE=$INT_MAX
|
||||||
|
fi
|
||||||
eval '$CVAINPUT -o $TOLERANCE --search-method $SEARCH_METHOD --timeout $TIMEOUT -s "waitfor $1" >> $OUTFILE'
|
eval '$CVAINPUT -o $TOLERANCE --search-method $SEARCH_METHOD --timeout $TIMEOUT -s "waitfor $1" >> $OUTFILE'
|
||||||
else
|
else
|
||||||
|
if [ -z "$TOLERANCE" ]; then
|
||||||
|
TOLERANCE=$INT_MAX
|
||||||
|
fi
|
||||||
eval '$CVAINPUT -t $TOLERANCE --search-method $SEARCH_METHOD --timeout $TIMEOUT -s "waitfor $1" >> $OUTFILE'
|
eval '$CVAINPUT -t $TOLERANCE --search-method $SEARCH_METHOD --timeout $TIMEOUT -s "waitfor $1" >> $OUTFILE'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user