#include "MouseOnEvent.au3"
#include "IsPressedEx.au3"
Global $a__MSG_LastMPos = -1
Global $s__MSG_Buffer = ''
_MouseSetGesture("{Ctrl}", "Right,Up", "_Gesture_RightUp_Proc")
Sleep(10000)
Func _MouseSetGesture($sModifiers, $sGestures, $sFuncName)
Local $aParam[3] = [$sModifiers, $sGestures, $sFuncName]
$a__MSG_LastMPos = MouseGetPos()
_MouseSetOnEvent($MOUSE_MOVE_EVENT, "__MouseSetGesture_Handler", 0, 0, $aParam)
EndFunc
Func __MouseSetGesture_Handler($iEvent, $aParam)
Local $aMPos = MouseGetPos()
Local $sModifiers, $sGestures, $sFuncName
Local $iGesture_Left, $iGesture_Right, $iGesture_Up, $iGesture_Down
Local $iMoved_Left, $iMoved_Right, $iMoved_Up, $iMoved_Down
$sModifiers = $aParam[0]
$sGestures = $aParam[1]
$sFuncName = $aParam[2]
If $sModifiers <> '' And Not _IsPressedEx($sModifiers) Then
Return 0
EndIf
$aSplit_Gesture = StringSplit($sGestures, ',')
$iGesture_Left = (StringInStr($sGestures, 'Left') > 0)
$iGesture_Right = (StringInStr($sGestures, 'Right') > 0)
$iGesture_Up = (StringInStr($sGestures, 'Up') > 0)
$iGesture_Down = (StringInStr($sGestures, 'Down') > 0)
$iMoved_Left = ($aMPos[0] < $a__MSG_LastMPos[0])
$iMoved_Right = ($aMPos[0] > $a__MSG_LastMPos[0])
$iMoved_Up = ($aMPos[1] < $a__MSG_LastMPos[1])
$iMoved_Down = ($aMPos[1] > $a__MSG_LastMPos[1])
$a__MSG_LastMPos = $aMPos
If $iMoved_Left And $iGesture_Left Then
$s__MSG_Buffer &= 'Left,'
EndIf
If $iMoved_Right And $iGesture_Right Then
$s__MSG_Buffer &= 'Right,'
EndIf
If $iMoved_Up And $iGesture_Up Then
$s__MSG_Buffer &= 'Up,'
EndIf
If $iMoved_Down And $iGesture_Down Then
$s__MSG_Buffer &= 'Down,'
EndIf
$s__MSG_Buffer = StringRegExpReplace($s__MSG_Buffer, ',+$', '')
For $i = 1 To $aSplit_Gesture[0]
If Not StringInStr($s__MSG_Buffer, $aSplit_Gesture[$i]) Then
Return
EndIf
Next
$s__MSG_Buffer = ''
Call($sFuncName)
EndFunc
Func _Gesture_RightUp_Proc()
ToolTip('<Ctrl + Right-Up> Gesture recieved!')
EndFunc