Jump to content

Variable Problems


Recommended Posts

I know someone is going to tell me to make a better title, but I literally dont know what my problem IS.

so basically, Im trying to make a script look for a color and click it. and if it doesnt find it, then try and find a different color, but instead, when my script DOESNT find the color, it just give me an error. why? and how can I fix it?

Func search()
$pix1=PixelSearch(15,128,876,464,1453099)
$pix=PixelSearch(15,128,876,464,0)
If $pix1[0] > 0 Then
    If $pix1[1] > 0 Then
MouseClick("left",$pix1[0],$pix1[1])
Sleep(1000)
EndIf
Else
$pix1=PixelSearch(15,128,876,464,1453099)
$pix=PixelSearch(15,128,876,464,0)
If $pix[0] > 0 Then
    If $pix[1] > 0 Then
MouseClick("left",$pix[0],$pix[1])
Sleep(1000)
EndIf
EndIf
EndIf
EndFunc

If I hadn't said thank you yet, and you deserve it, than thank you...

Link to comment
Share on other sites

  • Developers

You didn't tell us what the error is but guess its an Array error on "If $pix1[0] > 0 Then"?

You need to test the returned @error !

Failure: Sets @error to 1 if color is not found.

Edited by JdeB

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