Nohybab Posted November 7, 2015 Posted November 7, 2015 I need to know how to get delays let's say for example 4 mouse clicks then get the total delayWhat i have tried:While 1 If _IsPressed ("01") = 1 Then $timer = TimerInit () Sleep (100) While _IsPressed ("01") Sleep (50) WEnd $timer2 = TimerInit () While _IsPressed ("01") Sleep (50) Wend $timer3 = TimerInit () While _IsPressed ("01") Sleep (50) WEnd $timer4 = TimerInit () $diff = TimerDiff ($timer + $timer2 + $timer3 + $timer4) MsgBox ($MB_TOPMOST, "", "Difference in milliseconds: " & @CRLF & $diff) EndIf WEndand While 1 If _IsPressed ("01") = 1 Then $timer = TimerInit () Sleep (100) Do Sleep (50) Until _IsPressed ("01") $timer2 = TimerInit () Do Sleep (50) Until _IsPressed ("01") $timer3 = TimerInit () Do Sleep (50) Until _IsPressed ("01") $timer4 = TimerInit () Do Sleep (50) Until _IsPressed ("01") $timer5 = TimerInit () $diff = TimerDiff ($timer + $timer2 + $timer3 + $timer4 + $timer5) MsgBox ($MB_TOPMOST, "", "Difference in milliseconds: " & @CRLF & $diff) EndIf WEndNo luck msg box just shows at first click.
jdelaney Posted November 7, 2015 Posted November 7, 2015 #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $iCounter = 0 While 1 If _IsPressed("01", $hDLL) Then $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf If $iCounter >=4 Then ExitLoop WEnd ConsoleWrite("done" & @CRLF) Nohybab 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Nohybab Posted November 7, 2015 Author Posted November 7, 2015 Thanks a lot for your help. I will try this.
Nohybab Posted November 7, 2015 Author Posted November 7, 2015 (edited) #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $iCounter = 0 While 1 If _IsPressed("01", $hDLL) Then $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf If $iCounter >=4 Then ExitLoop WEnd ConsoleWrite("done" & @CRLF) I can't seem to get the total delays between 4 clicks I tried this code:While 1 If _IsPressed ("01") = 1 Then $iCounter+=1 $timer = TimerInit () Sleep (100) While _IsPressed ("01") Wend $diff = TimerDiff ($timer) If $iCounter >=4 Then MsgBox ($MB_TOPMOST, "", "Difference in milliseconds: " & @CRLF & $diff) EndIf Endif WEnd Edited November 7, 2015 by Nohybab just made sleep to 100
jdelaney Posted November 7, 2015 Posted November 7, 2015 #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $iTimer = 0 $iCounter = 0 While 1 If _IsPressed("01", $hDLL) Then If $iCounter = 0 Then $iTimer = TimerInit() EndIf $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf If $iCounter >=4 Then ExitLoop WEnd $i = TimerDiff($iTimer) ConsoleWrite("done " & $i & @CRLF) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Nohybab Posted November 7, 2015 Author Posted November 7, 2015 #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $iTimer = 0 $iCounter = 0 While 1 If _IsPressed("01", $hDLL) Then If $iCounter = 0 Then $iTimer = TimerInit() EndIf $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf If $iCounter >=4 Then ExitLoop WEnd $i = TimerDiff($iTimer) ConsoleWrite("done " & $i & @CRLF) I did what you suggest and made the code like this:While 1 If _IsPressed("01") Then If $iCounter = 0 Then $iTimer = TimerInit() EndIf $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01") WEnd ConsoleWrite("_IsPressed - click removed." & @CRLF) EndIf $i = TimerDiff($iTimer) If $iCounter >=5 And $i <=10000 Then MsgBox ($MB_TOPMOST, "", "Difference in milliseconds: " & @CRLF & $i) EndIf WEndit is correct that it will show the delays after 5 clicks however the message box shows 5 times on different click delays, can you help me on how to make it just show once but with total delays? I am truly thankful from the bottom of my heart for your help.
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