Jump to content
Sign in to follow this  

Mouse Click, move, mouse click interpreted incorrectly

Recommended Posts


I couldn't think of a better description ;)

Basically, my problem is this...

In human terms, this is what my program is doing:

Move mouse to position 1

Loop here:

Move and click (MouseClick function) at position 2

Move back to position 1

End Loop.

In my program, position 2 is incrementing by one every iteration of the loop. In the applet I'm interfacing with, clicking draws a pixel on the screen. Because it's a little slow (i.e. sometimes clicks don't register) the mouse is moved back to position one to check if the pixel has been drawn. Basically, it should draw a line on the screen. Instead, it'll sometimes draw a line from position 1 to position 2, which is odd since the mouse is never moving whilst being clicked. I've tried MouseMove->MouseDown->MouseUp as well, but that still gives the weird behaviour.

I've attached a screenshot of what it's doing. There should be a green line at the top, but there are diagonals that come from position 1 to whatever position 2 was at the time.

Thanks in advance for any help.


Share this post

Link to post
Share on other sites

BTW, here is the code I'm trying to use to do this...

For $j = 0 to 298
    For $i = 0  to 398

In this section, the stuff I've commented out is the other approaches I've been trying.

Func DrawColour($InputColour,$x,$y,$Handle)
        ;Takes an input colour and then clicks the mouse on the grid until it equals the colour.
        ; $InputColour: The hex colour of the element. Can be taken from $Element[2]
        ; $x,$y the co-ordinates of the pixel, in relation to the Powder Game box.
        ; $Handle: The window handle of the browser window.
;~  MouseMove($x+$CoOrdsX,$y+$CoOrdsY,0)
;~  MouseDown("primary")
;~  MouseUp("primary")
;~  Sleep(50)
;~  $delay = 0

If it doesn't make sense, I can explain the variables more...

Share this post

Link to post
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
Sign in to follow this