Jump to content
Sign in to follow this  
hrabikk

PixelSearch problem

Recommended Posts

hrabikk

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
hrabikk

$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
Jos

$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
  • Like 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        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  

×