Sign in to follow this  
Followers 0
diikee

Continue on error

6 posts in this topic

$oForm = _IEFormGetObjByName ($oIE, "myform")
$fr = _IEFormElementGetObjByName ($oForm, "mine") 
$frop = _IETagNameGetCollection($fr, "OPTION")
    For $fro in $frop
        If ($fro.innerText) = "180" Then
            _IEFormElementOptionselect($fr, "180", 1, "bytext") 
                Sleep(2000)
             ExitLoop
        EndIf
    Next    
Sleep(3000)

$fr = _IEFormElementGetObjByName ($oForm, "mine") ;------->>>>What if it doesn't exists, how do I exit with a nice comment and continue with the script execution instead of stopping the test??

Share this post


Link to post
Share on other sites



If you look at the documentation for the function (check your Include folder, with the IE.au3 file), you'll see the following in the function notes:

@ERROR - 0 ($_IEStatus_Success) = No Error

- 3 ($_IEStatus_InvalidDataType) = Invalid Data Type

- 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type

- 7 ($_IEStatus_NoMatch) = No Match

So you'll want to look at the error value after calling the function, which you can do through the "@error" macro. Just check what its value is, and then you can branch accordingly in your program.

Share this post


Link to post
Share on other sites

thanks Leighwyn....I should have seen that

Share this post


Link to post
Share on other sites

I cant really understand??

My question is if you run a function and if it a error how do you make it to continue the script and not existing on the error?

Share this post


Link to post
Share on other sites

I cant really understand??

My question is if you run a function and if it a error how do you make it to continue the script and not existing on the error?

Sorry this is a little delayed but If you are still looking for a solution try this

If @error Then
    ;look for form again??
EndIf

I am no pro at coding so it is just a suggestion, no guarantees it will work.


AutoViewer first public AutoIt script

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

you need to put this at the top of your script: _IEErrorHandlerRegister()

Edited by ludocus

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