Jump to content

capture mouse click delay


Nohybab
 Share

Recommended Posts

I need to know how to get delays let's say for example 4 mouse clicks then get the total delay

What 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
WEnd

and

 

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
WEnd

No luck msg box just shows at first click.

Link to comment
Share on other sites

#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)

 

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.
Link to comment
Share on other sites

#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 by Nohybab
just made sleep to 100
Link to comment
Share on other sites

#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.
Link to comment
Share on other sites

#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
WEnd

it 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.

Link to comment
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
 Share

×
×
  • Create New...