Sign in to follow this  
Followers 0
brett

PixelSearch Help Please

2 posts in this topic

I want this program to find a certain color, and keep clicking it until it goes away.

I'm not good with pixel stuff please help.

Search()

Func Search()
    Sleep(10)


$Place = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 779296, 10 )
    Sleep(10)

If @error Then
    Sleep(10)
    Search()
Else

MouseClick ( "left", $Place[0], $Place[1], 2 , 5 )
    Sleep(10)
EndIf
Endfunc

Error: Subscript used with non-Array variable.


-Brett

Share this post


Link to post
Share on other sites



think you made possible logic error here.

Search is calling itself repeatedly in case of errors ... and i don't think you want to do that recursion stuff.

you could do it this way:

Func Search()
   $PLACE = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 779296, 10)
   While @error
      Sleep(10)
      $PLACE = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 779296, 10)
   Wend
   MouseClick("left", $PLACE[0], $PLACE[1], 2, 5)
EndFunc  ;==>Search

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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