Sign in to follow this  
Followers 0
Maxisking

PixelSearch Function

9 posts in this topic

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 :(

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$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 this post


Link to post
Share on other sites

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

I think thats wrong.

Would it be {left}?

Share this post


Link to post
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 this post


Link to post
Share on other sites

Thanks for clearing this up!

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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 this post


Link to post
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 this post


Link to post
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. :P

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