Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

Preston, if you can find a public internet site and can post some code demonstrating your issue I would appreciate it.

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

Im having a noob problem here. When I try to even use a simple code like

#include <IE.au3>

_IECreate()

I get an Error : Error Reading File IE.au3

I downloaded the attachment and put it in the "include", but nothing.

Also what is the 0-Based Index and how can I find it. The form I am trying to select doesnt have a name, just a value.

Edited by milkman
Link to comment
Share on other sites

Hi Dale,

I found a repeatable error when using the UDF, aren't you happy to hear that? (Insert Sarcasm Here)

So it occurs when I attempt to lock onto the name of an existing IE window, (doesn't matter which), while I have my Anapod Explorer, (from Redchair software), window open for browsing my iPod files.

The error message is this:

If (ObjName($o_window.document) = "DispHTMLDocument") Then

If(^ERROR

When the Anapod window is not open, I do not get the error and it is able to interact with the IE window with no issues.

Not sure if anyone else has had similiar problems, but I'd almost bet it's not limited to just the Anapod Manager.

In any case, thanks again for all that you do Dale, you rule!

Best Regards-

Crim

Link to comment
Share on other sites

Im having a noob problem here. When I try to even use a simple code like

I get an Error : Error Reading File IE.au3

I downloaded the attachment and put it in the "include", but nothing.

Also what is the 0-Based Index and how can I find it. The form I am trying to select doesnt have a name, just a value.

@milkman

You could put the fill folder path into your #include instead of just the filename.

Regarding the 0-Based index... the forms on a page are included an a FORMS collection and they can be referenced by an index number in the order they appear on the page. This index starts with 0 (not 1).

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

Hi Dale,

I found a repeatable error when using the UDF, aren't you happy to hear that? (Insert Sarcasm Here)

So it occurs when I attempt to lock onto the name of an existing IE window, (doesn't matter which), while I have my Anapod Explorer, (from Redchair software), window open for browsing my iPod files.

The error message is this:

When the Anapod window is not open, I do not get the error and it is able to interact with the IE window with no issues.

Not sure if anyone else has had similiar problems, but I'd almost bet it's not limited to just the Anapod Manager.

In any case, thanks again for all that you do Dale, you rule!

Best Regards-

Crim

Thanks for the report, and you are right -- it is not just this application. It is also seen with the Outlook "Outlook Today" page, with the MSN Desktop Search search window and perhaps others. It is a very strange scenario where the window shows up as a member of the ShellWindows collection but does not have a .Document property.

The only way around it I have found at this point is using a custom error handler -- which I have been trying to avoid since there can only be one active at a time and I would need to remove a user-defined error handler in order to activate one specific to IE.au3. I may need to do this however and carefully manage the removal, replacement, removal and reinstatement of the user and IE.au3 COM error handlers.

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

ooo so I would use the

_IEFormGetCollection()

and then use the

_IEFormGetObjByIndex()

then

_IEFormSubmit()

?

You would only use _IEFormGetCollection() if you wnated to loop through the collection yourself like:

$oForms _IEFormGetCollection($oIE)

For $oForm in $oForms
   ;;; check a form attribute or do something
Next

Otherwise you would just use _IEFormGetObjByIndex() like:

$oForm = _IEFormGetObjByIndex($oIE,0)
_IEFormSubmit($oForm)

Note that many many forms now attach Javascript to their submit buttons and a simple form submit action often does not do what you want it to do. You often must get a reference to the submit button and then use a .click method on it like:

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)
$oSubmit = _IEFormElementGetObjByName($oForm, "SubmitButton")
$oSubmit.click

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

Note that many many forms now attach Javascript to their submit buttons and a simple form submit action often does not do what you want it to do. You often must get a reference to the submit button and then use a .click method on it like:

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)
$oSubmit = _IEFormElementGetObjByName($oForm, "SubmitButton")
$oSubmit.click

Dale

Few questions.

1. Why is there 2 $oForms in

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)

2. In

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)
what does the ($oIE, 0) mean?

3. What would I put in the

$oSubmit = _IEFormElementGetObjByName($oForm, "SubmitButton")
"SubmitButton" part? Edited by milkman
Link to comment
Share on other sites

Few questions.

1. Why is there 2 $oForms in

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)

2. In

$oForm = $oForm = _IEFormGetObjByIndex($oIE,0)
what does the ($oIE, 0) mean?

3. What would I put in the

$oSubmit = _IEFormElementGetObjByName($oForm, "SubmitButton")
"SubmitButton" part?
1) Typo. nuke one.

2) and 3) Please look at the examples in reply 3 of this post and look at the function headers for more information. Using this library requires that you know or learn some things about HTML and the document object model. If you post a new entry in the V3 support forum with the code you have tried and information about the HTML page that you are trying to work with you're likely to get all the help you need.

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

Last question hopefully.

I got the entire script working so Im like yay! Using this code

$oForm = _IEFormGetObjByIndex($oIE,2)
_IEFormSubmit($oForm)

But the probelm is about every 10 times, the form im looking to press isnt the number 2 on the page, so 1/10 it selects the wrong form. Any way to avoid this?

Link to comment
Share on other sites

Last question hopefully.

I got the entire script working so Im like yay! Using this code

$oForm = _IEFormGetObjByIndex($oIE,2)
_IEFormSubmit($oForm)

But the probelm is about every 10 times, the form im looking to press isnt the number 2 on the page, so 1/10 it selects the wrong form. Any way to avoid this?

Perhaps you missed this?

If you post a new entry in the V3 support forum with the code you have tried and information about the HTML page that you are trying to work with you're likely to get all the help you need.

With 24 pages of replies, this is not the place to discuss point-specific issues.

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

Hi, Dale

You did a wonderful job here!

I am new to AutoIt. But it's exciting to read the posts here.

Recently, I need to do some statistic projects related with IE webs.

I am thinking maybe your UDF will help.

e.g. if you open "www.newegg.com", you will see a column of constantly changing numbers, like population, births today, births of this year etc. Is it possible to retrieve those numbers at a fixed moment and do some simple computations as addition and subtraction? Thank you very much!

I appreciate your time and response.

MF

Link to comment
Share on other sites

I create IE object

$o_WS_IE=_IECreate (0)

to get result on the background.

But at some moment the site I visit opens new (unimportant) windows. What is the best way to prevent it?

Thank you.

Edited by APRES
Link to comment
Share on other sites

I create IE object

$o_WS_IE=_IECreate (0)

to get result on the background.

But at some moment the site I visit opens new (unimportant) windows. What is the best way to prevent it?

Thank you.

If you install a pop-up blocker for IE it should work in this mode as well. As for me, I stay away from sites that do such rude things when I can :o

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

It is webinterface to the worldwide flights booking engine which my company uses.

So I can't ignore it or ask them to change it.

Maybe solution is not in area of IE library. Sorry than for off topic.

But how is it best possible to controle if there is window with "text" we expect and to close it immediately when it is opened?

Link to comment
Share on other sites

It is webinterface to the worldwide flights booking engine which my company uses.

So I can't ignore it or ask them to change it.

Maybe solution is not in area of IE library. Sorry than for off topic.

But how is it best possible to controle if there is window with "text" we expect and to close it immediately when it is opened?

In a predictable environment (when you know something about the popups) you can use _IEAttach() and _IEQuit to grab and close the windows. You can also use standard AutoIt window commands (WinClose based on title for example).

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

Dale,

I'm not sure this is worthy of addressing, as there are ways around it, but:

Typically, when I create a new browser window using _IECreate, I am going to perform some action immedialtly following the creation of the new window. For instance:

$o_IENewWindow = _IECreate ()
_IEBodyWriteHTML ($o_IENewWindow, "Some Random Text")

or I may simply maximize the new window:

$o_IENewWindow = _IECreate ()
WinSetState("about:blank - Microsoft Internet Explorer", "", @SW_MAXIMIZE)

This works MOST of the time, but a significant number of times (>10%?), the script will error out with the dreaded "Object Not Found" error, as the New Window has not yet had time to load the Title (about:blank)

I've found if I modify _IECreate, I get the results I want 100% of the time:

Func _IECreate($f_visible = 1)
     $o_object = ObjCreate("InternetExplorer.Application")
     If IsObj($o_object) Then
         $o_object.visible = $f_visible
         $o_object.navigate ("about:blank")
         WinWait("about:blank - Microsoft Internet Explorer")  ;==New Line
         SetError(0)
         Return $o_object
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc  ;==>_IECreate

Since we are creating "about:blank" every time we use _IECreate(), making certain the title has actually loaded before proceeding has been an important thing for me. $o_object.navigate ("about:blank") does not get it done. Actions such as @SW_MAXIMIZE do not always work if the WinWait() function is not there.

At any rate, I am but a neophyte, and as such I realize that suggesting a change to a core function of yours may be pure folly, but I thought you might find it interesting.

Have a great week! ~ Lee

Link to comment
Share on other sites

@Lupusbalo

Very glad you like it!

Typically, when I create a new browser window using _IECreate, I am going to perform some action immedialtly following the creation of the new window.

This works MOST of the time, but a significant number of times (>10%?), the script will error out with the dreaded "Object Not Found" error, as the New Window has not yet had time to load the Title (about:blank)

Thanks Lee,

This has been a long-standing, nagging issue, but I have never been able to reproduce it. The solution you are using is reasonable, but relies on a behavior of IE that could change.

Could I please impose on you to try the following snippet in place of (and in exactly the same spot as) your mod?

While _IEGetProperty($o_object, "busy")
    Sleep(100)
WEnd

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...