# 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
If @error <> 1 Then;if pixel is found...

Endif
EndFunc```

Ok help .

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

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

##### Share on other sites

MouseClick("left");click the left mouse button

I think thats wrong.

Would it be {left}?

##### Share on other sites

Also another question

http://www.autoitscript.com/autoit3/docs/f...PixelSearch.htm

How do i get the

PixelSearch ( left, top, right, bottom )

Left top right bottom Coords? Cos there is two coords?

##### Share on other sites

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.

##### Share on other sites

Thanks for clearing this up!

No wonder it wouldnt find the pixel i had it all faked up

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

##### 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?

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.

##### Share on other sites

O srry ill explain, first it opens up The windows menu, then it find the windows live messenger icon and clicks it.

prety simple but it doesnt seem to be working.

## Create an account

Register a new account

×

• Wiki

• Back

• Git