Sign in to follow this  
Followers 0
D4rk^S0ul

PixelGetColor or CheckSum

6 posts in this topic

I was wonding if theres a way i can find the X, Y pos of a certain colour? i know the color, well wat is returned by PixelGetColor but i was wonding if i can use somethin to find X, Y of the pixel if it changes?

Share this post


Link to post
Share on other sites



I was wonding if theres a way i can find the X, Y pos of a certain colour? i know the color, well wat is returned by PixelGetColor but i was wonding if i can use somethin to find X, Y of the pixel if it changes?

Look in the help file for PixelSearch, I believe that is the function you are looking for.


[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Share this post


Link to post
Share on other sites

$SearchPosition = PixelSearch(xtop, ytop, xbottom, ybottom, color)
If IsArray($SearchPosition) Then
    MouseClick('left', $SearchPosition[0], $SearchPosition[1], 1, 1)
EndIf


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Smoke, yours will put the cursor over the color. Here's something from the helpfile (edited a little)-

$colour = "COLOR HERE"
$search = PixelSearch( @DesktopHeight, @DesktopWidth, @DesktopHeight, @DesktopWidth, $colour )
If Not @error Then
    MsgBox(0, "X and Y are:", $search[0] & "," & $search[1])
EndIf

It searches the whole screen for the color then tells you the xy of the color in a message box.

Share this post


Link to post
Share on other sites

Smoke, yours will put the cursor over the color. Here's something from the helpfile (edited a little)-

$colour = "COLOR HERE"
$search = PixelSearch( @DesktopHeight, @DesktopWidth, @DesktopHeight, @DesktopWidth, $colour )
If Not @error Then
    MsgBox(0, "X and Y are:", $search[0] & "," & $search[1])
EndIf

It searches the whole screen for the color then tells you the xy of the color in a message box.

Um, I know it does, it was to demonstrate as you did, that the coords were found, I was ASSuming he wanted to do something than a MsgBox to pop up and interrupt his script.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Lol, ok...

Dark, the command -

$search[0] and $search [1]

are used to get the xy of the pixel search. You can use em to click the xy, write it in a file, put it in a message box, or do anything cuz thats the beauty of autoit.

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