Jump to content

Mouse recorder...


Recommended Posts

So, as you can see from the code, I'm trying to correctly record mouse events, with pauses between clicks...Example :

I click at x,y

I don't do anything for 1,5sec

I click at a,b

a,b different from x,y ofcourse :D

HotKeySet ("{END}", "exiter")

$file = FileOpen (@ScriptDir & "\path.txt", 1)

While 1
    $begin0 = TimerInit()
    If _IsPressed (1) Then
        $dif0 = TimerDiff ($begin0)
        $coord0 = MouseGetPos()
        FileWrite ($file, $dif0 & @CRLF)    
        FileWrite ($file, $coord0[0] & "," & $coord0[1] & @CRLF)
        
        $begin2 = TimerInit()
        Do
            Sleep (100)
        Until _IsPressed (1)
        $dif2 = TimerDiff($begin2)
        $coord = MouseGetPos()
        FileWrite ($file, $dif2 & @CRLF)    
        FileWrite ($file, $coord[0] & "," & $coord[1] & @CRLF)
        $begin = TimerInit()
            Do
                Sleep (100)
            Until _IsPressed(1)
            $coord2 = MouseGetPos()
            $dif = TimerDiff($begin)
            FileWrite ($file, $dif & @CRLF) 
            FileWrite ($file, $coord2[0] & "," & $coord2[1] & @CRLF)
    EndIf
    Sleep (30)
WEnd

Func exiter()
    Exit
EndFunc

The sleep function doesn't seem to work, ex. I don't do anything for 2sec, and it writes that I didn't do anything for 10.14124 sec...Any help ? Thanks in advance !

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...