Jump to content

Some questions about PixelSearch


Recommended Posts

Heh, I've fooled around a bit more. Maybe diving into something too hard for my newby script writing mind, but anyhow -

The PixelSearch function needs coordinates (right?) to search a specific area.

The thing is, only one coordinate space is there to input coordinates into. In other words, there's no space for an X and a Y, just one. Maybe I'm not understanding this coordinates thing, but how do you specify a specific area without listing both coordinates?

Anyhow, after someone helps me out with that, how can I set the MouseClick function to click on the color that it finds?

Are the coordinates stored in a variable somewhere?

Thanks for any help, and please disregard the newbiness. I'll have this down someday :whistle:

Link to comment
Share on other sites

Heh, I've fooled around a bit more. Maybe diving into something too hard for my newby script writing mind, but anyhow -

The PixelSearch function needs coordinates (right?) to search a specific area.

The thing is, only one coordinate space is there to input coordinates into. In other words, there's no space for an X and a Y, just one. Maybe I'm not understanding this coordinates thing, but how do you specify a specific area without listing both coordinates?

Anyhow, after someone helps me out with that, how can I set the MouseClick function to click on the color that it finds?

Are the coordinates stored in a variable somewhere?

Thanks for any help, and please disregard the newbiness. I'll have this down someday :)

Ermm... :whistle:

Here's the Production version of PixelSearch():

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

...and here's the Beta version of PixelSearch():

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Left/Top is x/y for one corner, and Right/Bottom is x/y for the other corner of the rectangular search area. How many coordinates should it take?

Now, the function returns an array of just one x/y pair, indicating where it found the color. Read up on arrays in the help file if you don't follow that.

Assuming you wanted to search a square on the screen from 100/100 to 200/200 for a green pixel and then click on it:

$aPixel = PixelSearch(100, 100, 200, 200, 0x00FF00)
If @error Then
     MsgBox(16, "Error", "Green pixel not found.")
Else
     MouseClick("Left", $aPixel[0], $aPixel[1])
EndIf

:)

Edit: 0x00FF00 is not blue... it's green. Oops.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Left/Top is x/y for one corner, and Right/Bottom is x/y for the other corner of the rectangular search area. How many coordinates should it take?

LOL!

Thank you, I was thinking way too hard =P

I'll go check out what arrays are right now ;D

Edited by Wrench
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...