Jump to content

How to Handle errors In IE.au3


yadav
 Share

Recommended Posts

Iam collectiing one form by using function _IEFormCollection(IE,0), if this form doesn't exist in that frame or document then IE.au3 will throw errors,how to catch and handle those errors,please send me the code for this,thanks.

Link to comment
Share on other sites

Iam collectiing one form by using function _IEFormCollection(IE,0), if this form doesn't exist in that frame or document then IE.au3 will throw errors,how to catch and handle those errors,please send me the code for this,thanks.

Welcome to AutoIt! :)

In most cases the functions indicate errors by return value and the @error macro when things don't work. The function _IEFormCollection($oIE, 0) will do both. It returns 0 instead of an object, and sets @error to some non-zero value. You can test the return value with IsObj(), and check @error with a straight IF:

#include <IE.au3>

$oIE = _IECreate("www.google.com")

$oForm = _IEFormCollection($oIE, 0)
If Not IsObj($oForm) Then MsgBox(16, "Error", "Failed to get form object.")

$oForm = _IEFormCollection($oIE, 1)
If @error Then MsgBox(16, "Error", "_IEFormCollection() returned @error = " & @error)

If you are looking for help with a specific error, please post code to replicate the error and/or the Console text from SciTE.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...