Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

Yikes. This is not where you want to start with AutoIt -- you are missing basic concepts. You can look at the examples in reply 3 -- they are all complete (i.e. copy one into a file.au3 and you can run it. IE.au3 is an include file, not a stand-alone script (see #include in the helpfile).

Please spend time in the helpfile and the tutorial you'll find there.

Dale

Thanks for the reply Dale ... Yes i realise its an include and placed it in the autoit includes sub folder.

I attempted to then run some of the sample scripts and get the above error.

Not sure hat i have done incorrectly

Link to comment
Share on other sites

This is not the place to work this. Please log a post in the V3 Support forum and please, try some of the other simpler examples in the tutorial and the helpfile.

Dale

Thanks for the reply Dale ... Yes i realise its an include and placed it in the autoit includes sub folder.

I attempted to then run some of the sample scripts and get the above error.

Not sure hat i have done incorrectly

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 IFRAMEs

Hi Dale, thanks for your answer.

I gave up on the IFRAMEs issue. I tried all kind of stuff, but couldn't figure out a way how to access iframes via internet explorer automation. May be it is not possible at all?

Let's hope IFRAMEs is not used that much in web pages :-)

This is not the place to work this. Please log a post in the V3 Support forum and please, try some of the other simpler examples in the tutorial and the helpfile.

Dale

Link to comment
Share on other sites

Hey, i've been messing around with the _IEFormElementSetValue() function for dropdown boxes, it was working great until i tried it on a combination selection box. What i mean by that is, when u have 2 selection dropdown boxes, Selection 1 and Selection 2. And the way it is, depending on what i pick for Selection 1, the values inside Selection 2 will change. But when i set the value of Selection 1, Selection 2 won't change... is there a way to fix this?

[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

Hey, i've been messing around with the _IEFormElementSetValue() function for dropdown boxes, it was working great until i tried it on a combination selection box. What i mean by that is, when u have 2 selection dropdown boxes, Selection 1 and Selection 2. And the way it is, depending on what i pick for Selection 1, the values inside Selection 2 will change. But when i set the value of Selection 1, Selection 2 won't change... is there a way to fix this?

Please provide a reproducer... I'm not following your description.

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

Well, i just so happened to land on the site and started testing on it, i no longer have the link, but it still interests me how to fix this problem. Normally, i see quite a few sites with it, but i can't seem to find any right now, so i'll explaining again...

Ok, so first off, there are 3 drop down box's placed horizontally, part of a form.

so there's..

| Dropdown 1 | | Dropdown 2 | | Dropdown 3 | |Submit|

And here; say if u select value=1 on Dropdown 1, then on dropdown 2, u see a1,a2,a3,a4, and b1,b2,b3,b4. But if u select value=2 on Dropdown 1, u'll see c1,c2,c3,c4 on Dropdown 2, Dropdown 3 will show d1,d2,d3,d4.

Hope i explained that a little better... >.<

[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

Well, i just so happened to land on the site and started testing on it, i no longer have the link, but it still interests me how to fix this problem. Normally, i see quite a few sites with it, but i can't seem to find any right now, so i'll explaining again...

Ok, so first off, there are 3 drop down box's placed horizontally, part of a form.

so there's..

| Dropdown 1 | | Dropdown 2 | | Dropdown 3 | |Submit|

And here; say if u select value=1 on Dropdown 1, then on dropdown 2, u see a1,a2,a3,a4, and b1,b2,b3,b4. But if u select value=2 on Dropdown 1, u'll see c1,c2,c3,c4 on Dropdown 2, Dropdown 3 will show d1,d2,d3,d4.

Hope i explained that a little better... >.<

Sorry, no better. I need sample code. You seem to be saying that your selection in one drop-down affects another. This doesn't make sense unless there is some client-side javascript at work because each dropdown is a seperate OPTION object and not directly tied to another -- even if they are in the same form.

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 think the user may be referring to a page similar to this. Clicking an entry in the first listbox causes entries in the second to change and so on. I've seen similar things done with comboboxes, too, but I can't recall a site off-hand that does it.

Link to comment
Share on other sites

ya, it's pretty much exactly what Valik said =)

Edited by Faleira

[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

Ah, that makes sense now. In fact there is client-side Javascript behind this:

<select name="Region" size="10" onchange="PopulateSecondPane(this.form, this.form.Region.options[this.form.Region.selectedIndex].value);" style="font-family: arial; font-size: 8pt; width: 200px;" size="14" ID="Select1">

The values in the other fields change based on the onchange event getting fired by the previous one. Changing the value via script doesn't trigger the event, but fortunately this is pretty easy to do using the .fireEvent method. Here's a code sample based on the site that Valik provided. It sets the value of the Region field to North America (i.e. 11) and then fires the onchange event for the field which triggers the Javascript that updates the second field:

#include <IE.au3>

$sUrl = "http://creative.com/language.asp?sDestUrl=/support/downloads"

$oIE = _IEAttach($sUrl, "url")
If not isObj($oIE) Then
    $oIE = _IECreate()
    _IENavigate($oIE, $sUrl)
EndIf

$oForm = _IEFormGetObjByName($oIE, "Form1")
$oRegion = _IEFormElementGetObjByName($oForm, "Region")
_IEFormElementSetValue($oRegion, "11")
$oRegion.fireEvent("onchange")

This makes a good example.

Dale

Edit: I've added a little more annotation and added it as an example in reply 3 of this post. Also, on reflection, I think it would be convenient if this event to fire on a SetValue -- I'll set it to fire by default in the next release with an optional override.

Dale, I think the user may be referring to a page similar to this. Clicking an entry in the first listbox causes entries in the second to change and so on. I've seen similar things done with comboboxes, too, but I can't recall a site off-hand that does it.

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

I'm not sure if this web site has been mentioned here before, but there is a scrap of Javascript that will show you what DOM objects and elements are present on a web page and their current values. The web site is http://javascript.internet.com/page-details/dom-browser.html and the Javascript is called DOM Browser.

Link to comment
Share on other sites

hi there, i was able to start an instance of ie invisible, and i can navigate to a file, but then the file download dialog is displayed, but i want the source code of the file, ( no i can not use inetget, because of the cookie management, the page uses.

is it possible to download the file to a directory ?

i alreade have done the following steps:

1. create someting like callto: or mailto: for my application in the internet explorer preferences

2. create a dummy exe which displays the link as msg box and executes another instance of the ie with com objects. ( this is the instance which should download the file.)

3. get the file without file open dialog. <<<

4. execute the file

no it is not a kind of virus installer, its a torrent file starter B) with IE cookie management feature.

please help

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

I'm not sure if this web site has been mentioned here before, but there is a scrap of Javascript that will show you what DOM objects and elements are present on a web page and their current values. The web site is http://javascript.internet.com/page-details/dom-browser.html and the Javascript is called DOM Browser.

@Confuzzled - Very interesting, I had not seen this before. We can use IE.au3 to inject and run this script into any webpage. It would be even more powerful if it spit out AutoIt syntax vor object references...

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 there, i was able to start an instance of ie invisible, and i can navigate to a file, but then the file download dialog is displayed, but i want the source code of the file, ( no i can not use inetget, because of the cookie management, the page uses.

is it possible to download the file to a directory ?

: : : : :

@JRSmile -- I've read through your post several times and I'm not following exactly what you are asking. Do you want to download the source of an HTML page you've navigated to? Are you trying to do a "Save Target As... on a linked file? Something else?

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

ok my question in another way, is it possible to download a file to which i have navigated, without the silly "select download path" dialog? ( something like inetget but only with com functions.)

i ask this because of a silly webpage which does not allow a file download without the correct cockie session, and inetget does not hande cockies correctly. this is why i alwasy get a damaged file if i want to download it with inet get.

if the file is downloaded with a browser that has the correct cockie, it works.

kind regards,

Jan

Edited by JRSmile
$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

It is still your terminology of "download a file to which i have navigated" that confuses the question. If you are navigating to a typical webpage you typically would not refer to it as a "file" since it is often composed, at least in part, on the fly by server-side script. You can also navigate to a page where you can download a file like a .zip file or a .doc file.

I'll assume that it is the former you are asking about.

If what you want is the HTML associated with the displayed portion of the page (the <BODY>), you can use the _IEBodyReadHTML function. If you want the entire page (including the <HEAD> section - this is what INetGet does) then you can use

$sPageHTML = $oIE.document.getElementsByTagName("HTML").item(0).outerHTML
There is a function for this in the next version of IE.au3 after T1.4

Dale

ok my question in another way, is it possible to download a file to which i have navigated, without the silly "select download path" dialog? ( something like inetget but only with com functions.)

i ask this because of a silly webpage which does not allow a file download without the correct cockie session, and inetget does not hande cockies correctly. this is why i alwasy get a damaged file if i want to download it with inet get.

if the file is downloaded with a browser that has the correct cockie, it works.

kind regards,

Jan

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

but what if the target is not a html file.

i navigate to www.server.com/torrents/file.torrent and the sourcecode is loaded into $sPageHTML ?

would i be able to save this variable as working file?

or is the function "$oIE.document.getElementsByTagName("HTML").item(0).outerHTML"

already limited to a special part of the sourcecode, what i want to ask is that if i use your code can i get binary files? like inetget?

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")
For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)
Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI"
Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;
MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
Link to comment
Share on other sites

but what if the target is not a html file.

i navigate to www.server.com/torrents/file.torrent and the sourcecode is loaded into $sPageHTML ?

would i be able to save this variable as working file?

or is the function "$oIE.document.getElementsByTagName("HTML").item(0).outerHTML"

already limited to a special part of the sourcecode, what i want to ask is that if i use your code can i get binary files? like inetget?

Ah, OK and that's the other choice. So, no, IE.au3 currently only works with the DOM which is implemented by MSHTML. If a document type not handled by MSHTML is loaded another interface is required. I think you'll want to look into WinINet. It would make sense to expand IE.au3 in this direction in the future, but it does not include any of this today.

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,

Excuse me for my bad English, but it's a machine translation.

To start, thank you for this program, which opens enormous prospects in automation via Internet Explorer.

I wish to automate the parameter setting of a peripheral, the posting of Setup uses a frame. The problem is that I fall systematically in error when I wish to click on the link.

I join the codes of the pages to you :

index.html

<html><head><title>Configuration Utility</title></head>
     <frameset border=0 cols=150,*>
        <frame name=menu src=menu.cgi scrolling=yes>
        <frame name=main src=main.cgi scrolling=yes>
        <frame name=main src=empty.html scrolling=yes>
     </frameset>
</html>

menu.cgi

<html><head><title></title></head><body bgcolor=#c0c0c0><h1 align=center></h1><small>
<IMG src=Icons/exec.gif width=13 height=16 border=0 align=bottom> 
<font color=#000080>
<b>Administration</b>
</font>
<ul>
<li><A target="main" href="register-prologue/register.cgi">
Activation
</A>
<li><A target="main" href="mlconfig/password.cgi">
Configuration
</A>
<li><A target="main" href="mlconfig/logout.cgi">
Deconnecter
</A>
</ul>
</body></html>

main.cgi

<html><head><title>STAFFX</title></head><body bgcolor=ffffff><h1 align=center>STAFFX</h1>
<center><IMG src=thinclient/setuplogo.gif border=0 align=center></center>
</body></html>

Here is my tiny code B)

#include <IE.au3>

$o_IE = _IECreate()
_IENavigate($o_IE, "local.test.fr", 1)

$o_Frame = _IEFrameGetObjByName($o_IE, "menu")
_IEClickLinkByIndex($o_Frame, 1)

Here is the error message. :graduated:

Line 570 (File "C:\Autoit\IE.au3"):

$doc=$o_object.document
$doc=$o_object.document^ERROR

Error: The requested action with this object has failed.

I use the last version beta of Autoit.

By advance thank you for any answer ! :o

Edited by Whaouu
Link to comment
Share on other sites

Hello,

Excuse me for my bad English, but it's a machine translation.

To start, thank you for this program, which opens enormous prospects in automation via Internet Explorer.

I wish to automate the parameter setting of a peripheral, the posting of Setup uses a frame. The problem is that I fall systematically in error when I wish to click on the link.

I join the codes of the pages to you :

index.html

<html><head><title>Configuration Utility</title></head>
     <frameset border=0 cols=150,*>
        <frame name=menu src=menu.cgi scrolling=yes>
        <frame name=main src=main.cgi scrolling=yes>
        <frame name=main src=empty.html scrolling=yes>
     </frameset>
</html>

menu.cgi

<html><head><title></title></head><body bgcolor=#c0c0c0><h1 align=center></h1><small>
<IMG src=Icons/exec.gif width=13 height=16 border=0 align=bottom> 
<font color=#000080>
<b>Administration</b>
</font>
<ul>
<li><A target="main" href="register-prologue/register.cgi">
Activation
</A>
<li><A target="main" href="mlconfig/password.cgi">
Configuration
</A>
<li><A target="main" href="mlconfig/logout.cgi">
Deconnecter
</A>
</ul>
</body></html>

main.cgi

<html><head><title>STAFFX</title></head><body bgcolor=ffffff><h1 align=center>STAFFX</h1>
<center><IMG src=thinclient/setuplogo.gif border=0 align=center></center>
</body></html>

Here is my tiny code B)

#include <IE.au3>

$o_IE = _IECreate()
_IENavigate($o_IE, "local.test.fr", 1)

$o_Frame = _IEFrameGetObjByName($o_IE, "menu")
_IEClickLinkByIndex($o_Frame, 1)

Here is the error message. :graduated:

Line 570 (File "C:\Autoit\IE.au3"):

$doc=$o_object.document
$doc=$o_object.document^ERROR

Error: The requested action with this object has failed.

I use the last version beta of Autoit.

By advance thank you for any answer ! :o

Menu.cgi is not an HTML file it is a cgi that's only can invoke by an http request on dynamic website like php

I think it's while you have a problem

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