Jump to content

Recommended Posts

Posted

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?

Posted

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

  • Moderators
Posted

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

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.

Posted

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.

  • Moderators
Posted

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.

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.

Posted

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.

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
×
×
  • Create New...