Jump to content

loop is messing up


Recommended Posts

hey everyone...i made this script and it works fine...other than the fact that if the error takes place then the loop messes up...

heres the script...

sleep (5000)

$pixel = 13816329

for $r = 1 to 5

$a = pixelsearch (841,508,850,513,$pixel,5)

if @error Then

mousemove (870,358)

sleep (1000)

mouseclick ("left")

Else

mousemove ($a[0],$a[1])

sleep (1000)

mouseclick ("left")

sleep (800)

mouseclick ("left")

sleep (2800)

Endif

next

its fine if it finds the pixel...if it doesnt the error part takes place and the loop is cut short...for example if it doesnt find the color the first try the error part goes and then the rest of it continues but it only repeats 3 times...iono what to do...please help!!!!

Link to comment
Share on other sites

It's not clear what you want to do. A simple answer might be to replace your current If statement with:

If Not IsArray($a) Then

If you need more help, you'll need to clarify what it is you want your script to do, and why you are using the code you chose. (Why a For loop that loops 5 times? etc.)

Edit: typo

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...