Jump to content

@error


 Share

Recommended Posts

#include <IE.au3>

_IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = 1]]]]] )

Success: Returns an object variable pointing to an InternetExplorer.Application object

Failure: Returns 0 and sets @ERROR

@Error:

0 ($_IEStatus_Success) = No Error

1 ($_IEStatus_GeneralError) = General Error

3 ($_IEStatus_InvalidDataType) = Invalid Data Type

4 ($_IEStatus_InvalidObjectType) = Invalid Object Type

6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout

8 ($_IEStatus_AccessIsDenied) = Access Is Denied

9 ($_IEStatus_ClientDisconnected) = Client Disconnected

------------

Just trying to understand...

If I use "_IECreate" and for some reason the page does not load (mentioned as Failure), 0 is returned. Why then... @Error: shows 0 ($_IEStatus_Success) = No Error.

I know there may be another way of looking at this. Can someone please explain.

I am using ver 3.3.6.1.

Link to comment
Share on other sites

On success it returns the object AND sets @error = 0. So you could test for success using either IsObj(), or check for @error = 0.

On any error, @error <> 0.

:blink:

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

Test Script 1 (Valid webpage):

-------------------

#include <IE.au3>

$oIE = _IECreate("http://telstra.com.au/")

MsgBox(0, "", @error)

Test Script 2 (Invalid webpage:):

-------------------

#include <IE.au3>

$oIE = _IECreate("http://http://telstra12121212.com.au//")

MsgBox(0, "", @error)

http://telstra.com.au/ ... takes to a valid webpage

http://http://telstra12121212.com.au// .... Internet Explorer cannot display the webpage

My issue...

Why does "MsgBox(0, "", @error)" give 0 in both case?

Link to comment
Share on other sites

Technically, IE didn't fail, it correctly loaded the correct page, which was the 404 Error or Server Not Found page in that case. IE does not return any errors to AutoIt in the process of that little redirection, and the function returns the object reference to that IE instance (not 0).

To verify the CORRECT page loaded, you should check something like _IEPropertyGet($oIE, "Title").

:blink:

Edited by PsaltyDS
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...