Jump to content

MouseClick recorder/player... Started, but can't finish....?


Recommended Posts

Well here's the script for starters:

#include <misc.au3>

Global $x=false, $tick=1, $hi=false, $read=1


While 1
HotKeySet("{F5}","Record")
HotKeySet("{F6}","StartStop")
HotKeySet("{ESC}","ExitNow")
Wend

Func ExitNow()
    MsgBox(0, "Hey there noob", "Cya, wouldn't wanna be ya!")
    Exit
EndFunc


Func Record()
    If $x=true Then
        $x=False
        DllClose($dll)
    elseif $x=false Then
        $x=true
    endif
    While $x=true
        Global $dll = DllOpen("user32.dll")
        $press=_IsPressed("01",$dll)
        If $press=1 Then
            $pos=MouseGetPos()
            IniWrite("Coords.ini","Coords","x"&$tick,$pos[0]);writes x1=XPos
            IniWrite("Coords.ini","Coords","y"&$tick,$pos[1]);writes y1=yPos
            $tick=$tick+1;Incriments so that the next time the loop is done, it writes
        ; x2 = XPos
        ; y2= XPos
        EndIf
        sleep(5)
    Wend
EndFunc

Func StartStop()
    $read=1
    If $hi= True Then
        $hi=False
    ElseIf $hi= False Then
        $hi=True
    EndIf
        
    While $hi = True    
        $replayx=IniRead(@ScriptDir&"\Coords.ini", "Coords", "x"&$read, "Error" )
        if $replayx="Error" Then
            $hi=False
            msgbox(0,"","Done")
        else
        $replayy=IniRead(@ScriptDir&"\Coords.ini", "Coords", "y"&$read, "Error" )
        MouseClick("left",$replayx,$replayy,1,0)
        $read=$read+1
        Sleep(800)
        endif
    WEnd    
EndFunc

Now for some reason when I do run this it records about 100+ clicks that I didn't even click... And if I attempt to record 2 spots and i go to the Play it clicks on the first one repeatedly because it records the first one like 100+ times...

Heres what my ini file looks like :S ::

[Coords]
x1=672
y1=98
x2=672
y2=98
x3=672
y3=98
x4=672
y4=98
x5=672
y5=98
x6=672
y6=98
x7=672
y7=98
x8=672
y8=98
x9=672
y9=98
x10=672
y10=98
x11=672
y11=98
x12=758
y12=492
x13=758
y13=492
x14=758
y14=492
x15=758
y15=492
x16=758
y16=492
x17=758
y17=492
x18=758
y18=492
x19=758
y19=492
x20=758
y20=492
x21=758
y21=492
x22=383
y22=86
x23=383
y23=86
x24=383
y24=86
x25=383
y25=86
x26=383
y26=86
x27=383
y27=86
x28=383
y28=86
x29=447
y29=8
x30=447
y30=8
x31=447
y31=8
x32=447
y32=8
x33=447
y33=8
x34=447
y34=8
x35=447
y35=8
x36=664
y36=11
x37=664
y37=11
x38=664
y38=11
x39=664
y39=11
x40=664
y40=11
x41=664
y41=11
x42=664
y42=11
x43=664
y43=11
x44=664
y44=11
x45=664
y45=11
x46=664
y46=11

What I'm thinking is when I press down left click, beings theres only a 5 millisecond pause (which is basically nothing), it records all the clicks when I have the left button held down for like that half a second that a human being takes to press the left button on your mouse.... Thats just a theory anyways... Not really sure what's going on. I did try putting in 1000 for that Sleep, but then it had troubles recording each click etc etc ><

Can anyone spot out the problem?

And my last and final question, is there anyway to record the length of time between each MouseClick such as what it done with _SoundLength...? Because this bot would be very un-universal if I had to put a set time between each clicks, because some people may want something double clicked and that would require no sleep and some might want from one corner of the screen to the other which would take a second... If I can figure out the way to record the length between each MouseClick I could just slip that in my IniWrite and have:

Sleep($time)

Thanks, sorry for the loads of typing, but I really want to get this working :).

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