Manioums Posted July 29, 2015 Share Posted July 29, 2015 Hi,I would like to know if it's possible to detect a "Tap" on a touch screen with _IsPressedI need to detect when a Tap is done outside my application.With "If _IsPressed(01, $hDLL) Then" it's working well with a mouse click. On a touch screen I must double Tap in order to have this condition true.It will be great if someon have a solution Thank you very much ! Link to comment Share on other sites More sharing options...
Manioums Posted July 29, 2015 Author Share Posted July 29, 2015 Ok i've found a solution with GetTouchInputInfo https://msdn.microsoft.com/en-us/library/windows/desktop/dd371582(v=vs.85).aspx Link to comment Share on other sites More sharing options...
ken82m Posted August 24, 2015 Share Posted August 24, 2015 (edited) Does anyone have any examples on how to "AutoIT" this?I have an adlib that monitors for clicks in one part of the screen, it works perfectly with a mouse click. But this machine is going to be touch only when deployed.Func DetectClick() $X = MouseGetPos(0) $Y = MouseGetPos(1) If $X > 1447 AND $X < 1611 AND $Y > 14 AND $Y < 32 AND _IsPressed(01) Then RunTabTip()EndFunc Edited August 24, 2015 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
EmilyLove Posted August 24, 2015 Share Posted August 24, 2015 (edited) I'm not sure if this helps your issue, but you could try the MouseOnEvent UDF to detect if the mouse was clicked. You can customize it to do x action if your cursor is inside specific coordinates with WinGetPos()I understand you need the condition to be true only on double click. In this case, see my example below.#include "misc.au3" $X = MouseGetPos(0) $Y = MouseGetPos(1) $BorderLeft = 0 $BorderTop = 0 $BorderRight = @DesktopWidth $BorderBottom = @DesktopHeight While 1 If $X > $BorderLeft And $X < $BorderRight And $Y > $BorderTop And $Y < $BorderBottom And _IsPressed(01) Then _OnSingleClick() WEnd Func _OnSingleClick() Do sleep(1) Until not _IsPressed(01) Local $timer = TimerInit() Do If $X > $BorderLeft And $X < $BorderRight And $Y > $BorderTop And $Y < $BorderBottom And _IsPressed(01) Then _OnDoubleClick() Until TimerDiff($timer) > 500 ;Delay in milliseconds to wait for a second click before assuming the event was single click. EndFunc ;==>_OnSingleClick Func _OnDoubleClick() MsgBox(0, "All good Bossun.", "Double Click Detected! Exiting...") Exit EndFunc ;==>_OnDoubleClick Edited August 24, 2015 by BetaLeaf Xandy 1 Link to comment Share on other sites More sharing options...
ken82m Posted August 25, 2015 Share Posted August 25, 2015 (edited) That code you wrote works perfectly with both the mouse and touchscreen. Thanks a lot Beta! -KennyI'm checking out the UDF too, I know I used it long ago but it used to interfere with some apps here and there. But I'm sure they worked out the kinks.I'm not sure if this helps your issue, but you could try the MouseOnEvent UDF to detect if the mouse was clicked. You can customize it to do x action if your cursor is inside specific coordinates with WinGetPos()I understand you need the condition to be true only on double click. In this case, see my example below.#include "misc.au3" $X = MouseGetPos(0) $Y = MouseGetPos(1) $BorderLeft = 0 $BorderTop = 0 $BorderRight = @DesktopWidth $BorderBottom = @DesktopHeight While 1 If $X > $BorderLeft And $X < $BorderRight And $Y > $BorderTop And $Y < $BorderBottom And _IsPressed(01) Then _OnSingleClick() WEnd Func _OnSingleClick() Do sleep(1) Until not _IsPressed(01) Local $timer = TimerInit() Do If $X > $BorderLeft And $X < $BorderRight And $Y > $BorderTop And $Y < $BorderBottom And _IsPressed(01) Then _OnDoubleClick() Until TimerDiff($timer) > 500 ;Delay in milliseconds to wait for a second click before assuming the event was single click. EndFunc ;==>_OnSingleClick Func _OnDoubleClick() MsgBox(0, "All good Bossun.", "Double Click Detected! Exiting...") Exit EndFunc ;==>_OnDoubleClick Edited August 25, 2015 by ken82m EmilyLove 1 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
EmilyLove Posted August 28, 2015 Share Posted August 28, 2015 No Problem. Glad to help. Link to comment Share on other sites More sharing options...
JennMaughan Posted January 22, 2017 Share Posted January 22, 2017 On 7/29/2015 at 6:26 AM, Manioums said: Ok i've found a solution with GetTouchInputInfo https://msdn.microsoft.com/en-us/library/windows/desktop/dd371582(v=vs.85).aspx Trying to figure this out. But goes above my understanding. I have a script that I am having students use while taking a test, But some of the computers the school has provided are touch screen. How can I change whatever is needed so only one tap on the answer is needed instead of a double tap? 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