Sign in to follow this  
Followers 0
DarkBoost

Touch Screen - _IsPressed Code

3 posts in this topic

I need to execute a script when a user does a Press + Hold on a Lenovo Touch Screen
The below script will trigger True when the user presses the screen then immediately return False so it's not acknowledging the Hold - using the mouse it works as expected.

Here is the example:

#include <Misc.au3>

Dim $time = 0

While 1
    Dim $press = _IsPressed(01)

    If ($press) Then
        $time += 1
    Else
        $time = 0
    EndIf


    If ($time == 5) Then _runScript()

    Sleep(1000)
WEnd

Func _runScript()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

sweet,  I posted this yesterday.  its similar to your but for a spacebar.  what you have written appears a lil odd to me.  

#include <Misc.au3>
;HotKeySet("{SPACE}","_Run")
$sHexKey=20


while 1
$pressed=_IsPressed($sHexKey)

if $pressed=1 then
    $timer=TimerInit()
EndIf

while $pressed=1
$pressed=_IsPressed($sHexKey)



if $timer<>0 and $pressed=1 Then
    $diff=TimerDiff($timer)
    if $diff > 1000 Then
        _Run()
        ExitLoop
   elseif $pressed<>1 then 
        exitloop
    Else
        sleep(100)
        EndIf
        EndIf
    WEnd

WEnd





Func _Run()

    ;......something to do here
    MsgBox("","","I ran")
Exit
    EndFunc

 

Edited by markyrocks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Found alternate solution - using Transparent GUI.

Edited by DarkBoost

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
Sign in to follow this  
Followers 0