Jump to content
Sign in to follow this  
DaleHohm

Internet Explorer Automation UDF library

Recommended Posts

Hi Dale,

Am I correct to think that "_IELoadWait" is working now, too?

Randall

<{POST_SNAPBACK}>

It should work much more consistantly now -- I changed it to work on the Document object and to use readyState instead of busy as an indicator.

It will get more attention with the ObjName function in the next release.

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

Share this post


Link to post
Share on other sites

I realize that this is the "Internet Explorer" automation, but perhaps in the future you could add support for Firefox. :evil:

That would make me very, very happy. :)

Share this post


Link to post
Share on other sites

I realize that this is the "Internet Explorer" automation, but perhaps in the future you could add support for Firefox.  :evil:

That would make me very, very happy.  :)

<{POST_SNAPBACK}>

You're assuming Firefox has an exposed object model to manipulate. It doesn't.

Share this post


Link to post
Share on other sites

You're assuming Firefox has an exposed object model to manipulate.  It doesn't.

<{POST_SNAPBACK}>

And that's the reason I am a noob at the moment when it comes to these things. :)

I don't know anything about the "exposed object models" but regardless... Shouldn't there be a different way to add automation to firefox?

Share this post


Link to post
Share on other sites

Dale,

SetError(0)
        $tmp = ObjName ($a)
        If @error = 1 Then $tmp = "&nbsp;"
        If $tmp = "0" Then $tmp = "&nbsp;"

The latest version of ObjName does not set an error anymore. It returns "" if no name could be found. It was a bug that it throwed an error in the preliminary version, now it's according to the documentation.

EDIT: This version of ObjName will be included in 3.1.1.64.

Regards,

-Sven

Edited by SvenP

Share this post


Link to post
Share on other sites

Dale,

SetError(0)
        $tmp = ObjName ($a)
        If @error = 1 Then $tmp = "&nbsp;"
        If $tmp = "0" Then $tmp = "&nbsp;"

The latest version of ObjName does not set an error anymore.  It returns "" if no name could be found.  It was a bug that it throwed an error in the preliminary version, now it's according to the documentation.

EDIT: This version of ObjName will be included in 3.1.1.64.

Regards,

-Sven

<{POST_SNAPBACK}>

Fantastic, thanks Sven. That will save A LOT of conditional code. It should also prevent the need for me to set an error handler for this and have to deal with whether there is already one declared.

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

Share this post


Link to post
Share on other sites

Hi, Dale,

I am having to use the old version still of ie.au3 due to timing difficulties.

Remember my query and your response....

Am I correct to think that "_IELoadWait" is working now, too?

; unfortunately I am still having to use my old pause mechanisms.

Additionally, I sometimes find the object not retrieved fully before next command after various issues;

1. Navigate.

[? also ? or ?same prob?2. ObjQuit. (and re-start a new object)]

I have 3 other questions, though;

A. Should I be re-writing my WebLogin macro with these other functions, and not bothering with forms?

B. I have a workaround by excising text from html for boosting an "iframe" site; are you likely to tackle that problem? [Looks complicated for different versions of windows etc as far as I can see]

C. I don't have a workaround inside "com" for boosting an "non-standard" login button (java etc); are you likely to tackle that problem?

Thanks for your thoughts,

Randall

Edited by randallc

Share this post


Link to post
Share on other sites

With the ObjName function available now, I think that most everything can be solved. If your issues lie with Frames, things work with the basics, but there needs to be some focused time spent here that I have not done yet for T1.4

Regarding your other questions, for 1. please supply a small reproducer. For A., not sure what "other functions" you are talking about -- there are multiple ways of referencing objects in the DOM, so you need to choose which you prefer. For B., see the frames comments above. For C., a small example would help, but it make take your own research into the DOM to see how to reference the object and .Click it.

Dale

Hi, Dale,

I am having to use the old version still of ie.au3 due to timing difficulties.

Remember my query and your response....

; unfortunately I am still having to use my old pause mechanisms.

Additionally, I sometimes find the object not retrieved fully before next command after various issues;

1. Navigate.

[? also ? or ?same prob?2. ObjQuit. (and re-start a new object)]

I have 3 other questions, though;

A. Should I be re-writing my WebLogin macro with these other functions, and not bothering with forms?

B. I have a workaround by excising text from html for boosting an "iframe" site; are you likely to tackle that problem? [Looks complicated for different versions of windows etc as far as I can see]

C. I don't have a workaround inside "com" for boosting an "non-standard" login button (java etc); are you likely to tackle that problem?

Thanks for your thoughts,

Randall

<{POST_SNAPBACK}>


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

Share this post


Link to post
Share on other sites

Is there a way to fill in the info for a password protected site, that pops up the IE dialog? for example, i just pulled one up in google, to show you what i mean exactly.

http://www.he.net/~jdoe/info/htaccess/exam...restricted.html

so you go to a .htaccess password protected site, is there a way to lock on to that and fill in that info, like you do for other ie forms?

Share this post


Link to post
Share on other sites

Is there a way to fill in the info for a password protected site, that pops up the IE dialog? for example, i just pulled one up in google, to show you what i mean exactly.

http://www.he.net/~jdoe/info/htaccess/exam...restricted.html

so you go to a .htaccess password protected site, is there  a way to lock on to that and fill in that info, like you do for other ie forms?

<{POST_SNAPBACK}>

I've actually spent a little time looking at this and that popup is a windows app dialog and I have found no way to get to it through COM or the DOM. The good news is that you'll be able to use the standard AutoIt functions (WinActivate, ControlSend etc) to see it and manipulate it -- you have to anticipate it appearing however and deal with it.

There used to be a way to prevent it from appearing by using a URL syntax like http://username:password@www.url.com but that ability has been stripped out of recent IE versions for security reasons -- you may still be able to use it with WinHttp, but I haven't tried.

It would seem logical that IE would have some sort of a state bit available through COM to let us know that the authentication dialog is being displayed, but I have found nothing that helps yet.

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

Share this post


Link to post
Share on other sites

Wait a minute. We are talking about autoit right? Why not:

WinWait("Connect to www.he.net")
ControlSetText("Connect to www.he.net", "", "Edit2", "username")
ControlSetText("Connect to www.he.net", "", "Edit3", "password")
;ControlClick("Connect to www.he.net", "", "OK")

Who else would I be?

Share this post


Link to post
Share on other sites

Hi!

How do I have to use it?

I use Beta 3.1.1.54 and he's saying that in line 275 ( If (ObjName($o_window.document) = "DispHTMLDocument") Then ) that ObjName is a "unknown function name". Do you know whta's wrong there?

Thanks, peethebee


vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Share this post


Link to post
Share on other sites

At the top of the base note there is a line starting with the word "Important" in bold. Please read that.

Also note that the Au3Check syntax checker (used by default in SciTe) will report this error even when other requirements have been met - but continuing to execution will work.

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

Share this post


Link to post
Share on other sites

@Dale

Great job I can use you function on my script "Firewall Log Analyser" as of now.

By pressing a button I will lookup the IP address in the WHOIS database on the Internet.

The only thing I didn't see, is that for those guys who are using an IExplorer Shell application (like myself using AVANT browser - a multitabbed Explorer of IE), the page are not opened in the Shell IExplorer.

This is the code I use to pick up the default browser

Func GetBrowser();Get Default Browser
    $Browser = StringSplit(RegRead("HKLM\SOFTWARE\Classes\HTTP\shell\open\command",""),"%")
    $HTTP = $Browser[1] & " " & "www.autoitscript.com"
EndFunc

Maybe you could add some check on IE shell applications being the default browser.

If your function is incorporated in my "Firewall log Analyser" I will release a new version to you all !!


Share this post


Link to post
Share on other sites

Great job I can use you function on my script "Firewall Log Analyser" as of now.

The only thing I didn't see, is that for those guys who are using an IExplorer Shell application (like myself using AVANT browser -  a multitabbed Explorer of IE), the page are not opened in the Shell IExplorer.

Maybe you could add some check on IE shell applications being the default browser.

<{POST_SNAPBACK}>

Thanks, I'm glad it is useful.

I understand your desire, but IE.au3 creates the browser instance using the ObjCreate COM function and not by issuing a Shell command (and more importantly, we need an Object Variable reference to the created browser in order for any of the other functions to work).

You should be able to do what you want however by using _IEAttach to obtain a reference to an existing shell instance that, in your case, would be in AVANT. Note that you can attempt to _IEAttach and it it fails, run a shell command to create what you want, WinWait() for it and then use _IEAttach to get the object reference you need for all of the IE.au3 functions.

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

Share this post


Link to post
Share on other sites

Is there a function or way to find out if a new button or form appears on the web page after for example pressing the submit button?

Share this post


Link to post
Share on other sites

Is there a function or way to find out if a new button or form appears on the web page after for example pressing the submit button?

<{POST_SNAPBACK}>

Sure. There are several ways to go about this and which one you chose would depend on what you wnated to do with the information.

You can use _IEBodyReadHTML to get all of the HTML on a page before and after the submit and then compare.

_IEFormGetCount will teel you how many forms are on the page

_IEFormGetCollection will return a collection of forms on the page

Actually, take a look at this post for a generalized example of looking at the elements on a page

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

Share this post


Link to post
Share on other sites

$o_form = _IEFormGetObjByName($oIE, "BKPromoForm")
$o_CCBox = _IEFormElementGetObjByName($o_form, "CCBox")

; Set field values and submit the formBurger King Cash Card Redemption - Microsoft
_IEFormElementSetValue($o_CCBox,"BKDF-CJ8BLP-XDDLG2" ); insert code
$o_SubmitButton = $oIE.document.getElementById("SubmitBtn")
$o_SubmitButton.click
 Mouse1()
_IELoadWait($oIE,2000)
_IEFormElementSetValue($o_CCBox,"" )

Ok When I try setting the CCBox to blank it does not respond.....

Share this post


Link to post
Share on other sites

$o_form = _IEFormGetObjByName($oIE, "BKPromoForm")
$o_CCBox = _IEFormElementGetObjByName($o_form, "CCBox")

; Set field values and submit the formBurger King Cash Card Redemption - Microsoft
_IEFormElementSetValue($o_CCBox,"BKDF-CJ8BLP-XDDLG2" ); insert code
$o_SubmitButton = $oIE.document.getElementById("SubmitBtn")
$o_SubmitButton.click
 Mouse1()
_IELoadWait($oIE,2000)
_IEFormElementSetValue($o_CCBox,"" )

Ok When I try setting the CCBox to blank it does not respond.....

<{POST_SNAPBACK}>

I believe that since the page is recreated after the form submission (the click on the submit button) that the object reference to that element is no longer valid.

You need to establish a new connection with $o_CCBox after the refresh.

Another choice would be to reference it in a dynamic fashion like this:

_IEFormElementSetValue($oIE.document.GetElementById("CCBox"))

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

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...