Jump to content

Ie.au3 T2.0 Internet Explorer Automation Library


DaleHohm
 Share

Recommended Posts

I seem to have this problem occur often....

Also, I often get

What exactly does that mean?

--> IE.au3 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch

Hmm... I thought this would be really obvious... You called _IEFormElementGetObjByName and there was "NoMatch" for the name you passed.

Regarding the first error, I didn't expect to ever see that again after the rewrite in verson 2. Please post the code that lead to it.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi.

I was wondering if it is possible to add another function which will detect all IE error pages e.g. (Timeout error page, DNS error page etc) and set @error according to the IE error type.

In addition to the regular errors that regularly show up in the status bar e.g. (Done with errors etc)

I think that all these error pages should be stored in shdoclc.dll Not sure

Right now, I read the HTML body and then I look for (pagerror.gif).

Thanks

RK

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

Hi.

I was wondering if it is possible to add another function which will detect all IE error pages e.g. (Timeout error page, DNS error page etc) and set @error according to the IE error type.

In addition to the regular errors that regularly show up in the status bar e.g. (Done with errors etc)

I think that all these error pages should be stored in shdoclc.dll Not sure

Right now, I read the HTML body and then I look for (pagerror.gif).

Thanks

RK

@RK

This is an interesting and logical suggestion. Unfortunately, it presents some architectural obsticles.

First, the Navigate method does not have a return value, so the status of a navigate request is not available directly. Second, IE.au3 isn't necessarily still in control when the page load is complete (the $f_wait flag can be set to 0 or the loadwait timeout can expire). The method you are using is not a bad idea, but it could easily change with browser versions or configuration.

There is an event that can be used to retrieve this error status called NavigateError (find out more information here). This fires when a navigation error occurs and gives you access to the status. You can register for this event with ObjEvent() but I have not done any testing with it. I don't see a straight forward way of adding in this functionality without adding some significant complexity into IE.au3 and for the end user. I'll give it some more thought, but I don't expect to add it as core functionality at this point.

Dale

Edit: typos

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@DaleHohm

I experience a COM error when using this function together with _IECreateEmbedded().

And the Error is is logic, because you can't Quit and IE instance in an Embedded State.

===============================================================================
;
; Function Name:   _IEQuit()
; Description:      Close the browser and remove the object reference to it
; Parameter(s):     $o_object   - Object variable of an InternetExplorer.Application
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  On Success - Returns 1
;                  On Failure - Returns 0 and sets @ERROR = 1
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEQuit($o_object)
    If Not IsObj($o_object) Then
        SetError(1)
        Return 0
    EndIf
;
    SetError(0)
; $o_object.quit ()
    $o_object = 0
    Return 1
EndFunc ;==>_IEQuit

There an extra check should be added in the _IEQuit routine when using _IECreateEmbedded().

Something like this:

Func _IEQuit($o_object)
    If Not IsObj($o_object) Then
        SetError(1)
        Return 0
    EndIf

    If $_IEembedded = 0 Then; Some flag should be updated if _IECreateEmbedded() is used.
    SetError(0)
    $o_object.quit ()
    $o_object = 0
        Else
    SetError(0)
    $o_object = 0
    Endif
    Return 1
EndFunc ;==>_IEQuit

Can you confirm that this is a problem.

Thanks

Edited by ptrex
Link to comment
Share on other sites

@ptrex

Yes, you are correct. the Quit method is not valid with an embedded browser control. There are actually several things taht fall into this categoty (properties for addressbar, statusbar etc.). I catch most of these but neglected this one. I can do an object type check and branch over the Quit method (but still set the object variable to 0). In the mean time you should set your object variable to 0 and avoid the _IEQuit function for these objects.

Actually, after further consideration, the right answer is to disaalow _IEQuit for anything other than a stand-alone browser. It really has no meaning for an embedded control. The control will be destroyed only when its container is destroyed and you need to release the variable by setting it to 0 or null as you would any other. Thanks for reporting this.

Thanks,

Dale

Edit: removed comment about excluding embedded from commands that should accespt it... should already be OK. Edit2: added comment about disallowing

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@DaleHolm

I don' t fully agree with your statement :

the right answer is to disaalow _IEQuit

because at the moment it contains 2 functions.

1. to "Quit" the object and

2. to destroy the object.

Since you provide a function to create an embedded object "_IECreateEmbedded()", it is nesecerry to have a function to destroy the object as well.

This is if you want to keep things consistant anyway ? :)

Therefore, either an seperate function is needed to do the "Quit" object.

And a separate function to destroy the object.

Or like I demonstrated 1 combined function, that takes care of both, conditionaly.

Regards

Link to comment
Share on other sites

@DaleHolm

I don' t fully agree with your statement : because at the moment it contains 2 functions.

1. to "Quit" the object and

2. to destroy the object.

Since you provide a function to create an embedded object "_IECreateEmbedded()", it is nesecerry to have a function to destroy the object as well.

This is if you want to keep things consistant anyway ? :)

Therefore, either an seperate function is needed to do the "Quit" object.

And a separate function to destroy the object.

Or like I demonstrated 1 combined function, that takes care of both, conditionaly.

Regards

The important thing is that it does not in fact destroy anything -- the actual object will stay around as long as its container hosts it. All you could do with this is to break your script's ability to communicate with it. I think that actually invites more confusion than it avoids. The other thing that turns out to be an issue is that _IECreateEmbedded does not in fact give you a handle to the webbrowser control, but rather to the top-level "window" that it hosts. I therefore have no way of differentiating this window from a window in a browser or in a frame (using ObjName) - and it doesn't make sense to "Quit" them.

I understand your logic and appreciate the suggestion, but I hope that this explains my point of view.

thanks,

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@DaleHohm

Thanks for the feedback.

I therefore have no way of differentiating this window from a window in a browser or in a frame (using ObjName)

I must say that you do have a differenciator. In case of an embedded object you always have a "GUICtrlCreateObj ". In case of a non embedded you don' t have one. So it is rather easy to distingius.

But it's your choise of cource, on how you write your IE.au3. :)

Regards

Link to comment
Share on other sites

@DaleHohm

Thanks for the feedback.

I must say that you do have a differenciator. In case of an embedded object you always have a "GUICtrlCreateObj ". In case of a non embedded you don' t have one. So it is rather easy to distingius.

But it's your choise of cource, on how you write your IE.au3. :)

Regards

Because of security restrictions, the window object does not know and cannot ascertain what container is hosting it. You would be passing a window object to _IEQuit and that is unfortunately all I know -- it is not possible for me to tell that it is in a GUICtrlCreateObj. Sorry.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I have a whole (quite large) script that uses your UDF religiously. Do you still need that snipplet? If so I'll jsut send you the whole script (Just don't pass it around).

Yes I do... but i am worried I won't be able to reproduce the problem, so anything you can do to narrow it down first, please do so... then go ahead and PM it to me.

thanks,

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

@DaleHohm

I was just teasing you !!

Let me explain :

===============================================================================
;
; Function Name:   _IEQuit()
; Description:      Close the browser and remove the object reference to it
; Parameter(s):     $o_object   - Object variable of an InternetExplorer.Application
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  On Success - Returns 1
;                  On Failure - Returns 0 and sets @ERROR = 1
; Author(s):        Dale Hohm
;
;===============================================================================
;
Func _IEQuit($o_object)
    If Not IsObj($o_object) Then
        SetError(1)
        Return 0
    EndIf
;
    SetError(0)
    $o_object.quit ()
    $o_object = 0
    Return 1
EndFunc  ;==>_IEQuit

As you can read from the function description : "Close the browser and remove the object reference to it'

Well this is what you can read in the Helpfile :

You don't need to delete Objects when you are finished. If a script exits, AutoIt tries to release all active references to Objects that had been created in the script. Same thing happens when you had defined a local Object variable inside a function, and the function ends with a return.

There is no need to delete an object when initiated in a function. When the function ends the objects are destroyed as well.

So to avoid misusing your _IEQuit() function together with the Embedded object.

Simply remove this line "$o_object = 0", and the problems are solved.

Also don' t forget to adjust the Function description to ""Closes the browser". :)

Great job anyhow, keep up the good work !!!

Regards,

Link to comment
Share on other sites

I am trying to use IE.au3, but I can not run even a simple sample code. Could someone detail the steps of download and installation. I had autoit v3 installed and I download the latest beta version, I right click the icon to save the target as ie.au3, when I run

; Create a browser window and navigate to a website

#include <IE.au3>

$oIE = _IECreate ()

_IENavigate ($oIE, "www.autoitscript.com")

I got the following error:

Line 418 (File "C:\AutoIt\IE.au3") Case "0" Error: "Case" statement with no matching "Select" statement.

Link to comment
Share on other sites

  • Developers

Posted Image

Posted Image

here u got some screens. i got the very very very last version of scite and autoit..

First image shows Beta run a script ..

Second image shows an error generated by a program... How was that compiled ?

When you use SciTE i assume you use Alt+F7 to Compile with BETA ?

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

ops i missed with beta compile when i snaged but i meant i use beta compile :)

Pls show the Alt+F7 Output pane log so I can check if all looks good ... Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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