Jump to content

PixelSearch problem


Recommended Posts

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.

Link to comment
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?

Link to comment
Share on other sites

  • Developers

$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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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