DarkBoost Posted August 29, 2016 Posted August 29, 2016 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
markyrocks Posted August 29, 2016 Posted August 29, 2016 (edited) sweet, I posted this yesterday. its similar to your but for a spacebar. what you have written appears a lil odd to me. expandcollapse popup#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 August 29, 2016 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning"
DarkBoost Posted August 29, 2016 Author Posted August 29, 2016 (edited) Found alternate solution - using Transparent GUI. Edited August 29, 2016 by DarkBoost
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