Jump to content

PixelSearch Function


Recommended Posts

Well, i want this script to Find the pixel, and click it.

pretty simple, but i cant get it to work, heres my code so far:

Func TestProgram
$Pixel = PixelSearch(32,309,2,2,0xADDEA4)
   If @error <> 1 Then;if pixel is found...

   Endif
EndFunc

Ok help :P.

Can you add ; to the code for me, So i know what u did :(

Link to comment
Share on other sites

$Pixel = PixelSearch(32,309,2,2,0xADDEA4);if found returns an x and y co-ordinate stored in an array with the name you used as 0 and 1
If Not @error Then;if it did find it then
    MouseClick("left", $Pixel[0], $Pixel[1] , 1, 0);move the mouse to it instantly click the left mouse button once
EndIf

Edited by FaT3oYCG

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Link to comment
Share on other sites

  • Moderators

Left = Top left "x" position of the rectangle you want to search

Top = Top left "y" position of the rectangle you want to search

Right = Bottom right "x" position of the rectangle you want to search (not really bottom, but you get the picture)

Bottom = Bottom right "y" position of the rectangle you want to search

Left/Top

xy........................................

............................................

............................................

............................................

........................................xy

--------------------Right/Bottom

So you would have two sets of x and y coords (a starting x, a starting y, an ending x and an ending y).

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.

Link to comment
Share on other sites

TestProgram()
Func TestProgram()
Send("{LWINDOWN}")
Send("{LWINUP}")
$Pixel = PixelSearch(14,288,42,316,0x58A6F7);if found returns an x and y co-ordinate stored in an array with the name you used as 0 and 1
If Not @error Then;if it did find it then
    MouseMove($Pixel[0], $Pixel[1] , 0 );move the mouse to it instantly
    MouseClick("");click the left mouse button
EndIf
EndFunc

This should work?

All it does is open up the menu?

Edited by Maxisking
Link to comment
Share on other sites

  • Moderators

TestProgram()
Func TestProgram()
Send("{LWINDOWN}")
Send("{LWINUP}")
$Pixel = PixelSearch(14,288,42,316,0x58A6F7);if found returns an x and y co-ordinate stored in an array with the name you used as 0 and 1
If Not @error Then;if it did find it then
    MouseMove($Pixel[0], $Pixel[1] , 0 );move the mouse to it instantly
    MouseClick("");click the left mouse button
EndIf
EndFunc

This should work?

All it does is open up the menu?

Are you seriously asking us this question? Are we to know what in the world you're doing? lol...

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.

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