Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

Sorry, there are 13 pages of replies in this post... I'm not sure which earlier post you are referring to. If you can explain your question more fully I'll try to give you a thoughtful answer.

Dale

nvm... i'm an idiot, just a simple .click >.>

But i have another question right now... When you use the script that u gave in the earlier posts, that finds all the elements on a page, the img one doesn't find background images. Is it possible to change it so that it does?

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 all,

I have one question, which I don't remember having seen here:

If I open a new window with

$myie=_IECreate()

I get the handle $myie

How do I get a different handle for a window, which opens when I perform a click on it, like:

_IEClickLinkByText($myie, "new link")

I was trying something like: $newhandle = _IEClickLinkByText($myie, "new link") (obviously it didn't work, but maybe it could be implemented?)

Or is it possible to convert between the handles of AutoIT and IE.AU3 handles, something like:

$newhandle = WinGetHandle("active") (I know this doesn't work, but something of this type)?

Best regards

mapi

Edited by mapi
Link to comment
Share on other sites

What you're asking for seems logical, but unfortunately, that connection does not exist. What you can do however is use _IEAttach() after you know such a new window has been created and get an object reference to it by matching a substring in Title, URL, body Text or body HTML.

Also be careful with terminology -- what you are refering to is not a handle, but an object reference (important not to confuse it with the window handles used by WinActivate etc.).

Dale

Hi all,

I have one question, which I don't remember having seen here:

If I open a new window with

$myie=_IECreate()

I get the handle $myie

How do I get a different handle for a window, which opens when I perform a click on it, like:

_IEClickLinkByText($myie, "new link")

I was trying something like: $newhandle = _IEClickLinkByText($myie, "new link") (obviously it didn't work, but maybe it could be implemented?)

Or is it possible to convert between the handles of AutoIT and IE.AU3 handles, something like:

$newhandle = WinGetHandle("active") (I know this doesn't work, but something of this type)?

Best regards

mapi

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

What you're asking for seems logical, but unfortunately, that connection does not exist. What you can do however is use _IEAttach() after you know such a new window has been created and get an object reference to it by matching a substring in Title, URL, body Text or body HTML.

Also be careful with terminology -- what you are refering to is not a handle, but an object reference (important not to confuse it with the window handles used by WinActivate etc.).

Dale

Hi Dale,

thank you for the reply.

I am just wondering, wouldn't it be possible to create such an object reference in analogy to the _IECreate()

$myie = _IECreate()

$myie = _IEClickLinkByText($myie, "new link")

Anyway, I now know how to proceed.

Best regards

mapi

Link to comment
Share on other sites

I am just wondering, wouldn't it be possible to create such an object reference in analogy to the _IECreate()

$myie = _IECreate()

$myie = _IEClickLinkByText($myie, "new link")

Possible perhaps, but problematic. I would have to automate the use of _IEAttach() based on the URL of the link -- there could already be another window with the same URL, the URL could redirect etc.

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

Just a really quick question...

To get the # of options within a dropdownbox i use _IEFormElementOptionGetCount() and to set the value to whatever i want it to, do i use _IEFormElementSetValue()?

[quote]If whenever you feel small, useless, offended, depressed, and just generally upset always remember......you were once the fastest and most vicious sperm out of hundreds of millions![/quote]

Link to comment
Share on other sites

Just a really quick question...

To get the # of options within a dropdownbox i use _IEFormElementOptionGetCount() and to set the value to whatever i want it to, do i use _IEFormElementSetValue()?

That's the idea. Give it a try. Just remember/realize that the "value" of a drop-down option menu is not always what is displayed, but a coded value e.g.
<option value="550">Art</option>

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

Hello All.

I am trying to use the _IEBodyReadHTML() function to retrieve the source code of a web page. I am automatically navigating to the web page on a secure site, so I can not just dump in the url. Is there a way to capture the source code on the "current" page without going to view, source, and then saving the source.....and then reading the source into an array...etc etc.

Thanks.

Link to comment
Share on other sites

Hello All.

I am trying to use the _IEBodyReadHTML() function to retrieve the source code of a web page. I am automatically navigating to the web page on a secure site, so I can not just dump in the url. Is there a way to capture the source code on the "current" page without going to view, source, and then saving the source.....and then reading the source into an array...etc etc.

Thanks.

I guess I don't understand your question, because taht is what _IEBodyReadHTML() does... Perhaps you could be more explicit with your question or post some sample code.

BTW, _IEBodyReadHTML() only reads what is inside the <BODY> tag. There will be a function in the next release or IE.au3 that returns the full page source. It uses the following:

$oIE.document.getElementsByTagName("HTML").item(0).outerHTML

Also, a related function is _INetGet()

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

Very cool stuff Dale...

I'm having problems using the _IEAttach()... but it's not your code... I think..

Basically, I'm trying to attach to an existing IE window.

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

#include <IE.au3>

$DUT = $Cmdline[1]

;Main

If WinExists("https://$DUT$ - Launchpad - Microsoft Internet Explorer") then

WinActivate("https://$DUT$ - Launchpad - Microsoft Internet Explorer")

$oIE = _IEAttach()

_IEClickLinkByText($oIE, "Logout")

Endif

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

And the error I get is:

$o_object = ObjCreate("InternetExplorer.Application")

$o_object = ^ ERROR

Error: Unknown function name

Is there something else I need to include to get these other functions to work? Is it the way that I'm trying to run it?

Any help from anyone is greatly appreciated... I'm totally new to AutoIT.

russell

Link to comment
Share on other sites

Very cool stuff Dale...

$o_object = ObjCreate("InternetExplorer.Application")

$o_object = ^ ERROR

Error: Unknown function name

Glad it looks useful to you.

Here are the 3 most common causes of this error from most common to least:

1) The ObjCreate command is only available in the Beta. Please scroll down to the bottom of the Downloads page for the link.

2) If you are using SciTe editor, make certain you use Alt-F5 to run with the beta.

3) If this is an Au3Check error rather than a run-time error it may work by telling execution to Continue anyway and may be due to out of date Au3Check syntax definitions.

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,

this IE lib is great.

I wrote a script parsing IE files in the backround.

But I've got two questions.

1.)

Everything works fine but everytime the IE object loads (invisible) the focus is lost by the active application.

Is there the possibility to start the IE object without getting the focus?

(I trieed to figure out to get the active application and restore it with winactivate.. but this works very poor sometimes even it doesn't, so I'm using send(!{tab}) which works better but not really good...

2.) Is there the possibility to save the loaded html file with the IE object?

greetings mozart90

Link to comment
Share on other sites

1.)

Everything works fine but everytime the IE object loads (invisible) the focus is lost by the active application.

Is there the possibility to start the IE object without getting the focus?

(I trieed to figure out to get the active application and restore it with winactivate.. but this works very poor sometimes even it doesn't, so I'm using send(!{tab}) which works better but not really good...

Sorry, I don't see this behavior. Do I understand your problem description? Here is test code:
#include <IE.au3>

Run("notepad.exe")
WinActivate("Untitled - Notepad")

$oIE = _IECreate(0)
ConsoleWrite("Invisible Browser Created" & @CR)

sleep(1000)

Send("Who has focus?")
ConsoleWrite("String sent to whatever window has focus..." & @CR)

;Cleanup
_IEQuit($oIE)
$oIE = 0

2.) Is there the possibility to save the loaded html file with the IE object?

I don't really understand what you are asking... Are you asking if you can get the HTML code by using the IE object? If so, the _IEBodyReadHTML does this for the HTML inside the <BODY> tags in the document. If you want ALL of the HTML on the page, either use the _INetGet function (see the beta helpfile) of use the following command that will be part of the next IE.au3 release:
$oIE.document.getElementsByTagName("HTML").item(0).outerHTML

Dale

Edit: fixed 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

hello dale,

I've run the test code. I think you expected to me read "Who has focus?" in the notepad window, didn't you? :-))

During IE Object is loaded the notepad window has lost its focus and after clean up the IE Object it is given back to notepad again.

It was run with autoit-v3.1.1.87 and under win98se / XP SP2...

The second question I posed, because I was developing my script without knowlege of your amazing IE.au3. So I'm

downloading a html file by InetGet($x_htm, $dest) for getting some Informations (->titel, IDs etc.) before starting IE and crawling in the IE cache directory.

So I thought I could get rid the InetGet command by saving the whole html file in IE (to save download time)- I just hoped to substitude it, because I wrote a tricky procedure for getting the Information out of the html file which works fine actually ...

mozart90

Edited by mozart90
Link to comment
Share on other sites

I've run the test code. I think you expected to me read "Who has focus?" in the notepad window, didn't you? :-)) During IE Object is loaded the notepad window has lost its focus and after clean up the IE Object it is given back to notepad again.

Yes -- that's what happens for me on XP SP2, same AutoIt beta version - the Notepad never loses focus. I don't know why it would on your machine. It would be best if you opened a seperate thread in V3 Support to discuss that issue and perhaps others have ideas and there could be some testing done with apps other than IE.

Hopefully I gave you some other ideas you can use download and parse your HTML. Also, regarding parsing HTML, you may want to take a look at an example in reply 37 that may give you some more ideas.

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

yoo there, is there ANY way to check if an windows made by this function is closed. I can't use the Winexist, because there is another window open with the same title... please help me :oB)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

yoo there, is there ANY way to check if an windows made by this function is closed. I can't use the Winexist, because there is another window open with the same title... please help me :oB)

Two ways that I have used. The simple one is to check the visibility:
If _IEGetProperty($oIE, "visible")
so long as you are not setting the window invisible on purpose, False will indicate that it has been destroyed.

The second uses asynchronous events:

$oEvt = ObjEvent($oIE, "IEEvent_")

Func IEEvent_Quit()
    ConsoleWrite("The browser has been closed..." & @CR)
; Put other code here like: Global $IE_Exists = False
EndFunc

Dale

Edit: I just thought about this second Event example... here is the better way I believe:

$oEvt = ObjEvent($oIE, "IEEvent_")

Func IEEvent_Quit()
    $oIE = 0; release object reference
EndFunc

This releases the object reference and allows you to test "If isObj($oIE)" in your main program logic.

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

mm NOP B) doesn;'t work

here's the error

C:\Program Files\AutoIt3\Include\IE.au3 (1406) : ==> The requested action with this object has failed.:

Return $o_object.Visible ()

Return $o_object.Visible ()^ ERROR

i used this: if not _IEGetProperty($o_Inbox, "visible")

p.s. how does that secnd example works like u told ?

Edited by zeroZshadow
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

mm NOP B) doesn;'t work

here's the error

C:\Program Files\AutoIt3\Include\IE.au3 (1406) : ==> The requested action with this object has failed.:

Return $o_object.Visible ()

Return $o_object.Visible ()^ ERROR

i used this: if not _IEGetProperty($o_Inbox, "visible")

I don't know what "mm NOP" means -- should I take offense?

Most certainly $o_Inbox is not the right type of object. Check objName($o_Inbox) -- it should be IWebBrowser2 which is what is returned by _IECreate() or _IEAttach().

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

$o_Inbox IS really made with _IECreate()

but how does that secnd example of urs work, maby i can use that.

p.s. :I don't know what "mm NOP" means -- should I take offense?"

no offense, i ment "*thinking* mmmmm, no ", but i always use NOP B)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
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...