mirror of
https://github.com/bspeice/libcvautomation
synced 2024-12-04 13:58:11 -05:00
Small changes to double-click functions, add mouse location functions
This commit is contained in:
parent
749788f733
commit
ad3f4d6c5d
@ -147,7 +147,7 @@ int main( int argc, char** argv )
|
||||
case 'i':
|
||||
timeout = atoi(optarg);
|
||||
break;
|
||||
|
||||
|
||||
case '?':
|
||||
/* Error routine */
|
||||
break;
|
||||
@ -192,8 +192,8 @@ Usage: \n\
|
||||
\t-c, --center:\t\tInstead of matching the top-left corner of an image,\n\
|
||||
\t\t\t\tmatch the center of the image.\n\
|
||||
\t-o, --sane-tolerance:\tSet the tolerance using a scale of 1-100,\n\
|
||||
\t-s, --string:\t\tCommand string - see below.\n\
|
||||
\t-i, --timeout:\t\tSpecify the timeout to use when using the 'waitfor' function\n\
|
||||
\t-s, --string:\t\tCommand string - see below.\n\
|
||||
\t\t\t\tPlease make sure to use the '-t' or '-o' options when using this.\n\
|
||||
\n\
|
||||
This program works kind of like a mini-language. All options\n\
|
||||
@ -213,6 +213,7 @@ Available commands:\n\
|
||||
\tmousejiggle:\tJiggle the mouse (helps to activate some widgets).\n\
|
||||
\tmousescrollu:\tScroll the mouse wheel up.\n\
|
||||
\tmousescrolld:\tScroll the mouse wheel down.\n\
|
||||
\tmouselocation:\tReturn the location of the mouse.\n\
|
||||
\tkeyclick:\tClick a keyboard button.\n\
|
||||
\tkeydown:\tPush and leave down a keyboard button.\n\
|
||||
\tkeyup:\tRelease a keyboard button.\n\
|
||||
@ -306,6 +307,8 @@ void checkXTEEnabled ( Display *display )
|
||||
*
|
||||
* \c mousescrolld: Scroll the mouse wheel down
|
||||
*
|
||||
* \c mouselocation: Return the current location of the mouse
|
||||
*
|
||||
* \c keyclick: Click a keyboard button.
|
||||
*
|
||||
* \c keydown: Push and leave down a keyboard button.
|
||||
|
@ -372,7 +372,7 @@ XF86MonBrightnessDown
|
||||
|
||||
/** \page xtest_command_strings xte_commandString() Command Strings
|
||||
This page describes the various command strings available for the \ref xte_commandString() function.
|
||||
\section mouseclick Mouse Click
|
||||
\section mousefunctions Mouse Functions
|
||||
\code 'mouseclick <button_number>' \endcode
|
||||
Click the mouse button \c <button_number> in-place.
|
||||
|
||||
@ -425,7 +425,11 @@ Scroll the mouse down 1 time - depending on window manager settings, etc., this
|
||||
Scroll the mouse up 1 time - depending on window manager settings, etc., this may be multiple lines.
|
||||
\note This is a wrapper function for clicking button 5 on the mouse
|
||||
|
||||
\section keyclick Key Button Click
|
||||
\section mouselocation Mouse Location
|
||||
\code 'mouselocation' \endcode
|
||||
Return the current location of the mouse pointer.
|
||||
|
||||
\section keyboard_functions Keyboard Functions
|
||||
\code 'keyclick <key_name>' \endcode
|
||||
Push and release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'space'. Please see \ref xtest_key_strings for a full list of special keys.
|
||||
|
||||
@ -622,7 +626,7 @@ Wait for an image to show up on screen. For example, this can be used to make su
|
||||
* \param displayLocation The Display of which to scroll the mouse
|
||||
*/
|
||||
|
||||
/** \fn void void xte_mouseScrollDown ( Display *displayLocation );
|
||||
/** \fn void xte_mouseScrollDown ( Display *displayLocation );
|
||||
* \brief Scroll the mouse down
|
||||
* \details This moves the mouse scroll wheel down one rotation, which may be multiple lines. What this really does is click mouse button 5.
|
||||
* \param displayLocation The Display of which to scroll the mouse
|
||||
|
@ -1040,6 +1040,10 @@ cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int
|
||||
|
||||
free(fileName);
|
||||
}
|
||||
else if (IS_CMD( s_commandString, "mouselocation" ))
|
||||
{
|
||||
resultPoint = xte_mouseLocation( displayLocation );
|
||||
}
|
||||
|
||||
/* Note that we will return (-1,-1) implicitly
|
||||
* if we don't recognize the argument */
|
||||
|
@ -71,7 +71,11 @@ err ()
|
||||
|
||||
click ()
|
||||
{
|
||||
eval $CVAINPUT -s 'mouseclick 1' >> $OUTFILE >> $OUTFILE
|
||||
if [ -n "$1" ]; then
|
||||
eval $CVAINPUT -s 'mouseclick $1' >> $OUTFILE >> $OUTFILE
|
||||
else
|
||||
eval $CVAINPUT -s 'mouseclick 1' >> $OUTFILE >> $OUTFILE
|
||||
fi
|
||||
return $?
|
||||
} # ---------- end of function click ----------
|
||||
|
||||
@ -98,7 +102,11 @@ click_xy ()
|
||||
|
||||
out "click_xy: " $X_LOC $Y_LOC
|
||||
|
||||
eval '$CVAINPUT -s "mousexy $X_LOC $Y_LOC" -s "mouseclick 1" >> $OUTFILE'
|
||||
if [ -n "$3" ]; then
|
||||
eval '$CVAINPUT -s "mousexy $X_LOC $Y_LOC" -s "mouseclick $3" >> $OUTFILE'
|
||||
else
|
||||
eval '$CVAINPUT -s "mousexy $X_LOC $Y_LOC" -s "mouseclick 1" >> $OUTFILE'
|
||||
fi
|
||||
|
||||
return $?
|
||||
} # ---------- end of function click_xy ----------
|
||||
@ -113,17 +121,26 @@ click_xy ()
|
||||
clickr_xy ()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
err "Did not specify an X increment..."
|
||||
return 255
|
||||
out "Did not specify an X increment, assuming (0, 0)"
|
||||
X_INC=0
|
||||
Y_INC=0
|
||||
else
|
||||
X_INC=$1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
err "Did not specify a Y increment..."
|
||||
return 255
|
||||
out "Did not specify a Y increment, assuming ($X_INC, 0)"
|
||||
else
|
||||
Y_INC=$2
|
||||
fi
|
||||
|
||||
out "clickr_xy: " $1 $2
|
||||
|
||||
eval '$CVAINPUT -s "mouserxy $1 $2" -s "mouseclick 1" >> $OUTFILE'
|
||||
if [ -n "$3" ]; then
|
||||
eval '$CVAINPUT -s "mouserxy $1 $2" -s "mouseclick 1" >> $OUTFILE'
|
||||
else
|
||||
eval '$CVAINPUT -s "mouserxy $1 $2" -s "mouseclick 1" >> $OUTFILE'
|
||||
fi
|
||||
|
||||
return $?
|
||||
} # ---------- end of function clickr_xy ----------
|
||||
@ -211,7 +228,11 @@ click_i ()
|
||||
|
||||
doubleclick ()
|
||||
{
|
||||
click && click
|
||||
if [ -n "$1" ]; then
|
||||
click $1 && click $1
|
||||
else
|
||||
click && click
|
||||
fi
|
||||
} # ---------- end of function doubleclick ----------
|
||||
|
||||
#--- FUNCTION ----------------------------------------------------------------
|
||||
@ -238,7 +259,11 @@ doubleclick_xy ()
|
||||
|
||||
out "doubleclick_xy $X_LOC $Y_LOC"
|
||||
|
||||
click_xy "$X_LOC" "$Y_LOC" && click
|
||||
if [ -n "$3" ]; then
|
||||
click_xy "$X_LOC" "$Y_LOC" "$3" && click "$3"
|
||||
else
|
||||
click_xy "$X_LOC" "$Y_LOC" && click
|
||||
fi
|
||||
|
||||
return $?
|
||||
} # ---------- end of function doubleclick_xy ----------
|
||||
@ -253,17 +278,26 @@ doubleclick_xy ()
|
||||
doubleclickr_xy ()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
err "Did not specify an X increment..."
|
||||
return 255
|
||||
out "Did not specify an X increment, assuming (0, 0)"
|
||||
X_INC=0
|
||||
Y_INC=0
|
||||
else
|
||||
X_INC=$1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
err "Did not specify a Y increment..."
|
||||
return 255
|
||||
out "Did not specify a Y increment, assuming ($X_INC, 0)"
|
||||
else
|
||||
Y_INC=$2
|
||||
fi
|
||||
|
||||
out "doubleclickr_xy: $1 $2"
|
||||
out "doubleclickr_xy: $X_INC $Y_INC"
|
||||
|
||||
clickr_xy "$1" "$2" && click
|
||||
if [ -n "$3" ]; then
|
||||
clickr_xy "$X_INC" "$Y_INC" "$3" && click "$3"
|
||||
else
|
||||
clickr_xy "$1" "$2" && click
|
||||
fi
|
||||
|
||||
return $?
|
||||
} # ---------- end of function doubleclickr_xy ----------
|
||||
|
Loading…
Reference in New Issue
Block a user