Global Const $tagPOINT = "struct; long X;long Y; endstruct;" Global Const $tagRECT = "struct; long Left;long Top;long Right;long Bottom; endstruct;" Global Const $tagPOINTER_INFO = "struct;struct;int pointerType;int pointerId;int frameId;int pointerFlags;hwnd sourceDevice;hwnd hwndTarget;struct;int ptPixelLocation_x;int ptPixelLocation_y;endstruct; struct;int ptHimetricLocation_x;" & _ "int ptHimetricLocation_y;endstruct; struct;int ptPixelLocationRaw_x;int ptPixelLocationRaw_y;endstruct;struct;int ptHimetricLocationRaw_x;int ptHimetricLocationRaw_y;endstruct;dword dwTime;" & _ "int historyCount;int inputData;dword dwKeyStates;UINT64 PerformanceCount;int ButtonchangeType;endstruct;" Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & "int touchFlags;int touchMask;struct;int rcContact_left;int rcContact_right;int rcContact_top;int rcContact_bottom;endstruct;struct;int rcContactRaw_left;int rcContactRaw_right;" & _ "int rcContactRaw_top;int rcContactRaw_bottom;endstruct;int orientation;int pressure;endstruct;" Global Const $TOUCH_FEEDBACK_DEFAULT = 0x1 Global Const $TOUCH_FEEDBACK_INDIRECT = 0x2 Global Const $TOUCH_FEEDBACK_NONE = 0x3 Global Const $PT_POINTER = 0x00000001 Global Const $PT_TOUCH = 0x00000002 Global Const $PT_PEN = 0x00000003 Global Const $PT_MOUSE = 0x00000004 Global Const $PT_TOUCHPAD = 0x00000005 Global Const $TOUCH_MASK_NONE = 0x00000000 Global Const $TOUCH_MASK_CONTACTAREA = 0x00000001 Global Const $TOUCH_MASK_ORIENTATION = 0x00000002 Global Const $TOUCH_MASK_PRESSURE = 0x00000004 Global Const $POINTER_FLAG_NONE = 0x00000000 Global Const $POINTER_FLAG_NEW = 0x00000001 Global Const $POINTER_FLAG_INRANGE = 0x00000002 Global Const $POINTER_FLAG_INCONTACT = 0x00000004 Global Const $POINTER_FLAG_FIRSTBUTTON = 0x00000010 Global Const $POINTER_FLAG_SECONDBUTTON = 0x00000020 Global Const $POINTER_FLAG_THIRDBUTTON = 0x00000040 Global Const $POINTER_FLAG_FOURTHBUTTON = 0x00000080 Global Const $POINTER_FLAG_FIFTHBUTTON = 0x00000100 Global Const $POINTER_FLAG_PRIMARY = 0x00002000 Global Const $POINTER_FLAG_CONFIDENCE = 0x00004000 Global Const $POINTER_FLAG_CANCELED = 0x00008000 Global Const $POINTER_FLAG_DOWN = 0x00010000 Global Const $POINTER_FLAG_UPDATE = 0x00020000 Global Const $POINTER_FLAG_UP = 0x00040000 Global Const $POINTER_FLAG_WHEEL = 0x00080000 Global Const $POINTER_FLAG_HWHEEL = 0x00100000 Global Const $POINTER_FLAG_CAPTURECHANGED = 0x00200000 Func Tap($X_Loc, $Y_Loc) DllCall('User32.dll','BOOL','InitializeTouchInjection','int',1,'dword',$TOUCH_FEEDBACK_INDIRECT) If @error Then Return -1 Else Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO) DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_TOUCH) DllStructSetData($tPOINTER_TOUCH_INFO,2,0) DllStructSetData($tPOINTER_TOUCH_INFO,7,$X_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,8,$Y_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000) DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE)) DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2) DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2) DllStructSetData($tPOINTER_TOUCH_INFO,31,90) DllStructSetData($tPOINTER_TOUCH_INFO,32,1024) DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_DOWN,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT)) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 Else DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndIf EndIf EndFunc Func DoubleTap($X_Loc, $Y_Loc, $TapSpeed) Tap($X_Loc,$Y_Loc) Sleep($TapSpeed) Tap($X_Loc,$Y_Loc) EndFunc Func MoveTouchPtr($X_Loc, $Y_Loc) DllCall('User32.dll','BOOL','InitializeTouchInjection','int',1,'dword',$TOUCH_FEEDBACK_INDIRECT) If @error Then Return -1 ; Update the pointer location Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO) DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_POINTER) DllStructSetData($tPOINTER_TOUCH_INFO,2,0) DllStructSetData($tPOINTER_TOUCH_INFO,7,$X_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,8,$Y_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000) DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE)) DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2) DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2) DllStructSetData($tPOINTER_TOUCH_INFO,31,90) DllStructSetData($tPOINTER_TOUCH_INFO,32,1024) ; Update the tap location ($POINTER_FLAG_UPDATE) DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_UPDATE,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT)) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndFunc Func TapDrag($X1_Loc, $Y1_Loc, $X2_Loc, $Y2_Loc) MoveTouchPtr($X1_Loc, $Y1_Loc) DllCall('User32.dll','BOOL','InitializeTouchInjection','int',1,'dword',$TOUCH_FEEDBACK_INDIRECT) If @error Then Return -1 Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO) DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_TOUCH) DllStructSetData($tPOINTER_TOUCH_INFO,2,0) DllStructSetData($tPOINTER_TOUCH_INFO,7,$X1_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,8,$Y1_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000) DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE)) DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2) DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2) DllStructSetData($tPOINTER_TOUCH_INFO,31,90) DllStructSetData($tPOINTER_TOUCH_INFO,32,1024) ; Tap the location, hold the tap ($POINTER_FLAG_DOWN) DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_DOWN,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT)) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 ; Update the pointer location Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO) DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_TOUCH) DllStructSetData($tPOINTER_TOUCH_INFO,2,0) DllStructSetData($tPOINTER_TOUCH_INFO,7,$X2_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,8,$Y2_Loc) DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000) DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE)) DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2) DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2) DllStructSetData($tPOINTER_TOUCH_INFO,31,90) DllStructSetData($tPOINTER_TOUCH_INFO,32,1024) ; Update the tap location ($POINTER_FLAG_UPDATE) DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_UPDATE,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT)) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 ; Update the tap location ($POINTER_FLAG_UP) DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndFunc