ozz Posted August 18, 2015 Share Posted August 18, 2015 Hi, new here I'm using AutoIt to load test applications. To do that I simulate mouse/keyboard input. Is there a way to simulate touch (preferably multitouch/gestures)?Thanks for your time,Ozz Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2015 Share Posted August 18, 2015 Hello and welcome to the forum. This could be done using InjectTouchInput. Now I am at the work but I can try to write an example in few hours. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
ozz Posted August 18, 2015 Author Share Posted August 18, 2015 I would be really grateful, I can't figure out how to call that function Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2015 Share Posted August 18, 2015 (edited) This is an AutoIt example based on this example (http://social.technet.microsoft.com/wiki/contents/articles/6460.simulating-touch-input-in-windows-8-using-touch-injection-api.aspx?PageIndex=2#Simulating_Tap) for a simple tap event, but it's not tested since I don't have a touch device:expandcollapse popupGlobal 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 = 'int pointerType;uint pointerId;uint frameId;int pointerFlags;handle sourceDevice;hwnd hwndTarget;' & $tagPOINT & $tagPOINT & $tagPOINT & $tagPOINT & _ 'dword dwTime;uint historyCount;int inputData;dword dwKeyStates;uint64 PerformanceCount;int ButtonChangeType;' Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & 'int touchFlags;int touchMask;' & $tagRECT & $tagRECT & 'uint orientation;uint pressure;' 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 Tap() Func Tap() DllCall('User32.dll','BOOLEAN','InitializeTouchInjection','uint',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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+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','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 Else DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndIf EndIf EndFuncPlease let me know if it works. Edited August 18, 2015 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
junkew Posted August 18, 2015 Share Posted August 18, 2015 How do you do load testing with autoit? How many parallel users do you simulate? FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
ozz Posted August 19, 2015 Author Share Posted August 19, 2015 (edited) expandpopupPlease let me know if it works.Unfortunatelly, it does not. I will try to spend some time going trough DLL's structure data. How do you do load testing with autoit? How many parallel users do you simulate?Acually, it's more about prolonged use of an application, repeating the same sequences over and over again. Maybe I shouldn't have used the word "load", sorry Edited August 19, 2015 by ozz Link to comment Share on other sites More sharing options...
Andreik Posted August 19, 2015 Share Posted August 19, 2015 I'll try to get a device to make some tests. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
ozz Posted August 19, 2015 Author Share Posted August 19, 2015 Hi, I got it to work. Changed structures a little bit and worked like a charm. Thank you for your help! expandcollapse popupGlobal 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 Tap() Func Tap() 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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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 Dgameman1 1 Link to comment Share on other sites More sharing options...
rektmuch Posted March 27, 2016 Share Posted March 27, 2016 On 8/18/2015 at 8:33 PM, Andreik said: This is an AutoIt example based on this example (http://social.technet.microsoft.com/wiki/contents/articles/6460.simulating-touch-input-in-windows-8-using-touch-injection-api.aspx?PageIndex=2#Simulating_Tap) for a simple tap event, but it's not tested since I don't have a touch device: expandcollapse popupGlobal 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 = 'int pointerType;uint pointerId;uint frameId;int pointerFlags;handle sourceDevice;hwnd hwndTarget;' & $tagPOINT & $tagPOINT & $tagPOINT & $tagPOINT & _ 'dword dwTime;uint historyCount;int inputData;dword dwKeyStates;uint64 PerformanceCount;int ButtonChangeType;' Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & 'int touchFlags;int touchMask;' & $tagRECT & $tagRECT & 'uint orientation;uint pressure;' 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 Tap() Func Tap() DllCall('User32.dll','BOOLEAN','InitializeTouchInjection','uint',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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+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','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 Else DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndIf EndIf EndFunc Please let me know if it works. On 8/19/2015 at 1:28 PM, ozz said: Hi, I got it to work. Changed structures a little bit and worked like a charm. Thank you for your help! expandcollapse popupGlobal 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 Tap() Func Tap() 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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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 hey guys am really a nub in coding i just want to know how to creat more than one touch in the same time and change the coordinate i get that these coordinate are (300,300) but i couldnt manage to creat another touch Link to comment Share on other sites More sharing options...
AutoBert Posted March 27, 2016 Share Posted March 27, 2016 5 hours ago, rektmuch said: hey guys am really a nub in coding i just want to know how to creat more than one touch in the same time and change the coordinate i get that these coordinate are (300,300) but i couldnt manage to creat another touch For telling this you just haven't hijacking a old thread. Creating a new one (with link to this) and showing scriptcode what you already tried is more effectiv as quoting known infos of a solved thread. Link to comment Share on other sites More sharing options...
rektmuch Posted March 27, 2016 Share Posted March 27, 2016 On 8/18/2015 at 8:33 PM, Andreik said: This is an AutoIt example based on this example (http://social.technet.microsoft.com/wiki/contents/articles/6460.simulating-touch-input-in-windows-8-using-touch-injection-api.aspx?PageIndex=2#Simulating_Tap) for a simple tap event, but it's not tested since I don't have a touch device: expandcollapse popupGlobal 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 = 'int pointerType;uint pointerId;uint frameId;int pointerFlags;handle sourceDevice;hwnd hwndTarget;' & $tagPOINT & $tagPOINT & $tagPOINT & $tagPOINT & _ 'dword dwTime;uint historyCount;int inputData;dword dwKeyStates;uint64 PerformanceCount;int ButtonChangeType;' Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & 'int touchFlags;int touchMask;' & $tagRECT & $tagRECT & 'uint orientation;uint pressure;' 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 Tap() Func Tap() DllCall('User32.dll','BOOLEAN','InitializeTouchInjection','uint',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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+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','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 Else DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOLEAN','InjectTouchInput','uint',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndIf EndIf EndFunc Please let me know if it works. On 8/19/2015 at 1:28 PM, ozz said: Hi, I got it to work. Changed structures a little bit and worked like a charm. Thank you for your help! expandcollapse popupGlobal 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 Tap() Func Tap() 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,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) 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 thnx Link to comment Share on other sites More sharing options...
autog Posted December 1, 2016 Share Posted December 1, 2016 Hi, sorry if diverging a bit, I wasn't sure whether to open a new thread, but can multi-touch input be detected, besides simulated? More exactly, each and every touch - can I somehow get the multi x&y coordinates (?) Thanks and any help much appreciated Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now