Jump to content

Recommended Posts

Posted

After some posting around the forum here, I've gotten a way to record the position of the mouse when the user clicks. What I need some help now is how I can "replay" the mouse clicks. I was thinking of using a Do While loop, but when it reaches the last recorded position, I want it to repeat back to the first, starting the process again until the user presses a certain key. So does anyone know how I would do that?

This is the code thus far:

CODE
#include <Misc.au3>

Dim $Position, $i = 0, $Record[1][2]

While 1

If _IsPressed("01") Then

$Position = MouseGetPos()

ReDim $Record[$i + 1][2]

$Record[$i][0] = $Position[0]

$Record[$i][1] = $position[1]

consoleWrite($Record[$i][0] & @LF & $Record[$i][ 1] & @LF)

Msgbox(0,"Mouse Position","x = "&$Record[$i][0] & @LF & "y = "& $Record[$i][1] & @LF)

$i += 1

EndIf

sleep(10)

WEnd

This is another slightly different version:

CODE
#include <Array.au3>

#include <Misc.au3>

Dim $Position, $i = 0, $Record[1]

While 1

If _IsPressed("01") Then

$Position = MouseGetPos()

$x = $Position[0]

$y = $position[1]

ReDim $Record[$i + 2]

$Record[$i] = $x

$Record[$i + 1] = $y

$i += 2

_ArrayDisplay($Record, "")

EndIf

sleep(10)

WEnd

MsgBox (0, "", $x & $y )

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

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
  • Recently Browsing   0 members

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