Jump to content

Continue on error


 Share

Recommended Posts

$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??

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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