Sign in to follow this  
Followers 0
trippdoctor

Script Help Probly very simple

6 posts in this topic

#1 ·  Posted (edited)

Ok what I am trying to do is use pixel search to find a certain and color and have it search for my color then left clicks at (790,336) and scan again and keep doing this till it finds that color I am looking for and then carry out the rest of my actions but I am uncertain on how to do this. Here is what I have.

;script below
sleep(1000)
MouseMove(868, 578)
MouseClick("Left")
MouseMove(555, 400)
MouseClick("left")
Sleep(1000)
MouseMove(875, 650)
MouseClick("left")
mousemove(500, 655)
mouseclick("left")
Send("my text")
sleep(2000)
While @error = 0
    $coor = PixelSearch( 222, 415, 285, 475, , , )  
    (I know I need somthing here)
Wend
mousemove(500, 655)
mouseclick("left")
then I want it to go back to line one but I am new at this so forgive me

Also I wish I could but I can't edit the title so don't get mad at me for spelling probably incorrectly.

Edited by trippdoctor

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Its almost been an hour and I would like some help here.

Edited by trippdoctor

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, so I'm a little confused. You want it to click on the pixel where it finds the color? Or you want it to look for the color, then click at 790,336?

While 1
    _MyClickFunction()
WEnd

Func _MyClickFunction()
    Local $coor = 0
   
    sleep(1000)
    MouseClick("Left",868,578)
    MouseClick("Left",555,400)
    Sleep(1000)
    MouseClick("Left",875,650)
    MouseClick("Left",500,655)
    Send("my text")
    Sleep(2000)
   
    ; Search for the pixel until it is found (red in this case).  The loop will not end until the color appears.
    Do
        $coor = PixelSearch(222, 415, 285, 475, 0xFF0000)
    Until IsArray($coor) = 1
   
    MouseClick("Left",790,336)

    MouseClick("Left",500,655)
EndFunc
Edited by covaks

Share this post


Link to post
Share on other sites

I want it to look for the color, then click at 790,336 and just for informational purposes how to you get the coordinates of a pixel of a certain color?

Share this post


Link to post
Share on other sites

Alright, then the script above should do what you've asked. You'll need to adjust the color value in the PixelSearch function for whatever color it is your searching for.

To get the coordinates of the pixel, PixelSearch returns an array that contains the coordinates of the color you searched for. element 0 is the X value, and 1 is the Y value.

So for example, to search for a pure BLUE pixel (0x0000FF) and get the coordinates.

$coordinates = PixelSearch(0,0,@DesktopWidth, @DesktopHeight, 0x0000FF) ; Search the whole screen for a pure blue pixel

If IsArray($coordinates) Then  ; If $coordinates is an array, then it found a pure blue pixel
   msgbox(0,"","Blue pixel found at: " & @CRLF & _
                "X=" & $coordinates[0] & @CRLF & _
                "Y=" & $coordinates[1])
EndIf

It starts at the top left corner of your screen, and works its way to the bottom right. The same way you read. across, down a line, across, etc. So it only returns the first Blue pixel it finds.

Is that what you meant by finding the coordinates of a pixel of a certain color?

Share this post


Link to post
Share on other sites

Yea both your posts really gave me in site on how to do things I learned a lot thanks.

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  
Followers 0