Sign in to follow this  
Followers 0
hrabikk

PixelSearch problem

4 posts in this topic

Hello, what should i change in this code to make it work?

$firstpixel=PixelSearch(100,100,100,200,0xFFFFFF,0,0)
       If Not @error Then
        $secondpixel=PixelSearch(200,$firstpixel[1]200,$firstpixel[1],0xFFFFFF,0,0)
           If Not @error Then
             MsgBox(0, "X and Y are:", $pixel1[0] & "," & $pixel1[1])
       EndIf
    EndIf

I want the 2nd pixelsearch starts from the firstpixel[1] Y array but it keeps getting errors that firstpixel[1] is used without being declared or smthing like that.

Share this post


Link to post
Share on other sites



$firstpixel=PixelSearch(237,553,237,700,0xFEFEFE,0,0)
   If Not @error Then
      sleep(50)
      $2ndpixel=PixelSearch($firstpixel[0]+2,$firstpixel[1]-5,$firstpixel[0]+2,$firstpixel[1]+5,0xFFFFFF,0,0)
      If Not @error Then
      ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0)
   EndIf
EndIf

And now error:

Subscript used with non-Array variable.:

ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0)

ToolTip("X and Y are:", $2ndpixel^ ERROR

>Exit code: 1    Time: 4.119

So where is the mistake this time?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$firstpixel=PixelSearch(237,553,237,700,0xFEFEFE,0,0)
   If Not @error Then
      sleep(50)
      $2ndpixel=PixelSearch($firstpixel[0]+2,$firstpixel[1]-5,$firstpixel[0]+2,$firstpixel[1]+5,0xFFFFFF,0,0)
      If Not @error Then
      ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0)
   EndIf
EndIf

And now error:

Subscript used with non-Array variable.:

ToolTip("X and Y are:", $2ndpixel[0] & "," & $2ndpixel[1],0,0)

ToolTip("X and Y are:", $2ndpixel^ ERROR

>Exit code: 1    Time: 4.119

So where is the mistake this time?

Check the PixelSearch details in the helpfile, esspecially the part that talks about when the Function fails to find the pixel.

The example shows what to do to test for this.

Jos

Edited by Jos
1 person likes this

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