Jump to content

Ie.au3 T2.0 Internet Explorer Automation Library


DaleHohm
 Share

Recommended Posts

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Is it possible to simulate a click on a server side image map? (isMap) You know, with cords and all. In and out of forms.

I worked on this some time ago and tried to make it work at a low level by manipulating the click event. I have since learned of the asynchronous event handling design of the AutoIt COM implementation taht explains why it was a dead end.

I think that it can be accomplished however by understanding the wat the infromation is sent back to the server... it appends "?x-coord,y-coord" to the URL of the associated href of the associated <a> tag.

So I would try this... first assume that the a tag looks like this

<a href="http://my.site.com/cgi-bin/map.pl">
<img src=image.gif ismap height=100 width=200>
</a>

try

_IENavigate($oIE, "http://my.site.com/cgi-bin/map.pl?50,100")

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 worked on this some time ago and tried to make it work at a low level by manipulating the click event. I have since learned of the asynchronous event handling design of the AutoIt COM implementation taht explains why it was a dead end.

I think that it can be accomplished however by understanding the wat the infromation is sent back to the server... it appends "?x-coord,y-coord" to the URL of the associated href of the associated <a> tag.

So I would try this... first assume that the a tag looks like this

<a href="http://my.site.com/cgi-bin/map.pl">
<img src=image.gif ismap height=100 width=200>
</a>

try

_IENavigate($oIE, "http://my.site.com/cgi-bin/map.pl?50,100")

Dale

Thats great but it still needs to send referrer information, I don't think _IENavigate() would as it would be a security risk. Also when you submit a serverside image map in a form it's slightly different in syntax(but thats not a problem). Is there a way to set header information using the UDFs?
Link to comment
Share on other sites

Thats great but it still needs to send referrer information, I don't think _IENavigate() would as it would be a security risk. Also when you submit a serverside image map in a form it's slightly different in syntax(but thats not a problem). Is there a way to set header information using the UDFs?

Slight modification would be to modify the URL of the anchor...

$oAs = _IELinkGetCollection($oIE)
For $oA in $oAs
    If $oA.href = "http://my.site.com/cgi-bin/map.pl" Then
        $oA.href = "http://my.site.com/cgi-bin/map.pl?50,100"
        $oA.click
        ExitLoop
    EndIf
Next

Also when you submit a serverside image map in a form it's slightly different in syntax

Grrrrr.... you didn't mention it was an input type=image... In that case, the data is the form data as elemName.x=50,elemName.y=100 and must be included in the POSTDATA of the header.

The Navigate method allows you to set the header information... See Here _IENavigate does not incorporate these parameters, so you'll need to call it manually...

Dale

Edit: typo

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

Hey Dale, I was wondering...

There's several different types of "Loadeds", in my oppinion. There's when the HTML loads, and there's when everything else (images, flash, etc.) loads...

Is there a way to only wait for the HTML to load? I'm not worried about any images or flash as long as I can still use your UDF functionality with only the HTML loaded, and speeding up the process without waiting for images, etc.

Lemme know, thanks.

Link to comment
Share on other sites

  • Moderators

Hey Dale, I was wondering...

There's several different types of "Loadeds", in my oppinion. There's when the HTML loads, and there's when everything else (images, flash, etc.) loads...

Is there a way to only wait for the HTML to load? I'm not worried about any images or flash as long as I can still use your UDF functionality with only the HTML loaded, and speeding up the process without waiting for images, etc.

Lemme know, thanks.

You can toggle images off during your script, just don't forget to toggle them back on.

; toggle images off
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "no")
; toggle images on
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "yes")
Link to comment
Share on other sites

Hey Dale, I was wondering...

There's several different types of "Loadeds", in my oppinion. There's when the HTML loads, and there's when everything else (images, flash, etc.) loads...

Is there a way to only wait for the HTML to load? I'm not worried about any images or flash as long as I can still use your UDF functionality with only the HTML loaded, and speeding up the process without waiting for images, etc.

Lemme know, thanks.

big_daddy's method should work if you do not want the images. If you want them but don't want to wait for them there is not reliable method I know of, but you can try creating your own routine to wait once you know the values of "readyState".

readyState returns a string and sometimes an integer so I always test for both:

uninitialized (or 0) = Object is not initialized with data.

loading (or 1) = Object is loading its data.

loaded (or 2) = Object has finished loading its data.

interactive (or 3) = User can interact with the object even though it is not fully loaded.

complete (or 4) = Object is completely initialized.

Something like this:

Do
    Sleep(100)
Until $oIE.document.readyState = 3 or $oIE.document.readyState = "interactive"

Make sure you set $f_wait to 0 for _IECreate, _IENavigate or other functions that call _IELoadWait for you.

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 one quick qustion. I made a script that creates an html form with write function in IE and I have it automaticly submit to an https with the post method. when the it submits and tries to load which it partly does, (yes to what I need loads) but the loadwait fucntion still waits because a security bar pops up.

My question is, is there a way to automaticly allow what ever it is trying to do? like emulate the allow option when you click the bar.

Thank you guys

Check out ConsultingJoe.com
Link to comment
Share on other sites

Dale,

I have a page, and I get a link colleciton from it. What I then want to do is loop thru the links and get the URLs for them. Can you give me an example of how to do this?

Sure... just so happens I already had that example ready to go:

#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    MsgBox(0, "Link Info", $oLink.href)
Next

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 one quick qustion. I made a script that creates an html form with write function in IE and I have it automaticly submit to an https with the post method. when the it submits and tries to load which it partly does, (yes to what I need loads) but the loadwait fucntion still waits because a security bar pops up.

My question is, is there a way to automaticly allow what ever it is trying to do? like emulate the allow option when you click the bar.

Thank you guys

@zc

I have not researched this yet... sorry. If I see a way to do this I'll post it here, but I don't know yet.

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

Sure... just so happens I already had that example ready to go:

#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    MsgBox(0, "Link Info", $oLink.href)
Next

Dale

Now let's say I have $oLinks collection, and the number of links. How would I get the href for Random(0, @EXTENDED) of $oLinks?

eg. $oLinks[13].href (which of course doesn't work)

Link to comment
Share on other sites

Now let's say I have $oLinks collection, and the number of links. How would I get the href for Random(0, @EXTENDED) of $oLinks?

eg. $oLinks[13].href (which of course doesn't work)

Close... the [] syntax doesn't work, but () does:

#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")
$oLinks = _IELinkGetCollection($oIE)
$ran = Random(0, @extended)
MsgBox(0, "Link Info", $oLinks($ran).href)

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 really need to know how you guys do find the variables like in the next example:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
$oButton = _IEFormElementGetObjByName($oForm, "btnG")

_IEFormElementSetValue($oQuery, "Search String")
$oButton.focus()
Send("{Enter}")
_IELoadWait($oIE)

Exit

How do you get the variables like f and q and btnG. Do you read the html code on the page? or is there a Window Info tool?

There is also i tool wich i tried, but thats even harder to understand :D . I think i am not seeying wich will make the Ooooh effect :D

Edited by Iznogoud
Link to comment
Share on other sites

I Think Dale wrote a snippet to get all ellements from a web page listed in a orderly fashion.

You can also open up the source (CTRL+U) in FireFox and search for "Name=".

That was a few sugestions but I'm not into web stuff so don't take my word for it :D

Link to comment
Share on other sites

There are so many pages in this thread now. I couldn't find this posted so I'll post it.

I have the Version: T2.0-3

When I do a _IELinkClickByText a success returns -1 instead of 1

edit: OK, a lot of them return -1 now??? I don't understand.

I have updated all of my old scripts to work with this by simply making the function calls as If _IELinkClickByText(***) Then

instead of how I had it as If _IELinkClickByText(***) = 1 Then

Apparently -1 is seen as 1 when you leave it blank...

Mike

Edited by MikeOsdx
Link to comment
Share on other sites

There are so many pages in this thread now. I couldn't find this posted so I'll post it.

I have the Version: T2.0-3

When I do a _IELinkClickByText a success returns -1 instead of 1

edit: OK, a lot of them return -1 now??? I don't understand.

I have updated all of my old scripts to work with this by simply making the function calls as If _IELinkClickByText(***) Then

instead of how I had it as If _IELinkClickByText(***) = 1 Then

Apparently -1 is seen as 1 when you leave it blank...

Mike

Hi Mike,

I return -1 for functions that really have no return value. A call to Navigate is another example. When I call $oIE.navigate I didn't want to return 1 indicating success when the Navigate function give me no return vaolue at all -- you might imply that success means that we actually navigated to a page (instead of getting a 404 Page Not Found error) but we really have no wy of knowing. I also don't know if it failed either so I don't want to return 0.

I use -1 as indeterminate, but it is non-zero, so you can test the return value logically and it will return True (i.e. If @error). This is what I recommend instead of testing for a value of 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

I'm very pleased to announce the updated test release T2.0-4 of the Internet Explorer Automation Library, IE.au3. I believe this code to be quite stable and barring any problems uncovered it will be submitted to the core AutoIt UDF distribution.

Please see the basenote for more information.

Enjoy!

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

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