Sign in to follow this  
Followers 0
Vindicator

Variable Problems

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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

was that in the help file? I obviously missed it then... thanks!


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

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