Manioums

_IsPressed and Tap on Touch Screen

7 posts in this topic

Hi,

I would like to know if it's possible to detect a "Tap" on a touch screen with _IsPressed

I 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 !

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by BetaLeaf

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That code you wrote works perfectly with both the mouse and touchscreen. Thanks a lot Beta!   -Kenny

I'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 by ken82m
1 person likes this

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites

No Problem. Glad to help.

 


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
On 7/29/2015 at 6:26 AM, Manioums said:

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?  

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now