Sign in to follow this  
Followers 0
SweatyOgre

What the hell?

2 posts in this topic

#1 ·  Posted (edited)

Grrrr, I get this error every time i run my script.

Posted Image

Here's the section of code it's from:

$XY = PixelSearch(314, 192, 507, 389, 0x7898D8)
    Sleep(3500)
    If Not @error Then 
  MouseClick("left",$XY[0],$XY[1], 1, 0)

Since $XY apparently isn't an array, how do I make it one?

Edited by SweatyOgre

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

$XY = PixelSearch(314, 192, 507, 389, 0x7898D8)
$err = @error
Sleep(3500)
If Not $err Then
 MouseClick("left",$XY[0],$XY[1], 1, 0)

Your problem is that the value of the @error flag is reset to zero after the sleep statement (successfully) runs. Consequently, your If-Then test will always evaluate to true regardless of if the PixelSearch was successful. I think @error trips up everyone at some point--so welcome to the club :D Backup the value of @error if you do not use it right away!

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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