Sign in to follow this  
Followers 0
yadav

How to Handle errors In IE.au3

2 posts in this topic

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.

Share this post


Link to post
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

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