Sign in to follow this  
Followers 0
guysmilie

Repeat step/line on error...

4 posts in this topic

Excuse me if this has been answered elsewhere, I did do a quick search, but did not find the answer.

Is there a simple way to have a step/line in a script "retry" a number of times if it fails the first time?

Thanks in advance to anyone who can help,

Guy.

Share this post


Link to post
Share on other sites



Are you talking about in the script or while running the script thru an editor? If the later it depends on the editor but some have a built in function where it shows you where the script failed and allows you to re-run that section. However I assume you mean the former in which case wouldnt...

;somefunction
If (@error) Then
;repeat said function
EndIf

Be kind of what your looking for? Many autoit functions set @error when it encounters a problem. If you are not talking about a script error than replace teh (@error) with some manditory variable aka <>0 or whatnot. Unless'm totally missing the mark.

Share this post


Link to post
Share on other sites

Thanks for your reply. I am totally new at this. I will research the set @error you mentioned. Do you happen to know if the function ControlClick does this?

I am assuming the idea is to use a loop if @error = 0/1, repeat loop?

Thanks for your help, much appreciated,

Guy.

Are you talking about in the script or while running the script thru an editor? If the later it depends on the editor but some have a built in function where it shows you where the script failed and allows you to re-run that section. However I assume you mean the former in which case wouldnt...

;somefunction
If (@error) Then
;repeat said function
EndIf

Be kind of what your looking for? Many autoit functions set @error when it encounters a problem. If you are not talking about a script error than replace teh (@error) with some manditory variable aka <>0 or whatnot. Unless'm totally missing the mark.

Share this post


Link to post
Share on other sites

Do you happen to know if the function ControlClick does this?

The only way to know that for sure is to open your helpfile, browse to the function you're interested in and look at the "Return Value" section. It will list any Return and/or Error values you can use to check for error/success.

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