Jump to content

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.

post-48365-126146813118_thumb.jpg

Link to comment
Share on other sites

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

For $j = 0 to 298
    Sleep(100)
    For $i = 0  to 398
        DrawColour($Element[2],$i,$j,$Handle)
    Next
Next

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)
    MouseClick("primary",$x+$CoOrdsX,$y+$CoOrdsY,1,0)
;~  $delay = 0
EndFunc

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

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