Sign in to follow this  
Followers 0
RealisT

_IEDocWriteHTML can't create images

8 posts in this topic

#include <IE.au3>
$ieWin = _IECreate("", 0, 1, 1, 1)

$webStr = "<html><head></head><body>"
$webStr = $webStr & "<img src='file:///C:/MyProject/Images/TestImage.jpg' width=330 height=65>"
$webStr = $webStr & "</body></html>"

_IEDocWriteHTML($ieWin, $webStr)
Windows XP SP3 IE8

I have a script which is to create a simple webpage using _IEDocWriteHTML or _IEBodyWriteHTML. However, this method will not let me render an image on the new webpage.

(The image path is VALID; this has been confirmed). I am using absolute file paths. I have tried refreshing & not refeshing the page after creation, too.

An independent webpage with this HTML works fine. But it will not render the image if this HTML is generated via _IEDocWriteHTML or _IEBodyWriteHTML.

I've tried these path variations without success:

C:\MyProject\Images\BattleshipsLogo.jpg

file:///C:/MyProject/Images/BattleshipsLogo.jpg

C:\\MyProject\Images\BattleshipsLogo.jpg

Why is this happening?

Is there a vital HTML change needed for use with AutoIt?

Share this post


Link to post
Share on other sites



For once, I don't see any end to the image tag ... </img>

That is not AutoIt related :x


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Adding </img> does not change the result.

In eleven years I have never used or needed the </img> end-tag. I've always understood it to be superfluous / deprecated. In any case, I've yet to find a browser that requires it.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry - you were right about that - the end image tag does nothing about that.

@Deathbringer - It doesn't have and end tag indeed, my bad to not checking first.

Please watch your language, hot temper and foul language didn't help anybody. You can make your point in a polite way.

Edit: doesn't work for me either, regardless of the image you use.

You can have a workaround: create an empty file in the @Temp folder (e.g. empty.html) the use the following code:

#include <IE.au3>
$ieWin = _IECreate("file:///c:\temp\empty.html", 0, 1, 1, 1)

$webStr = "<img src='C:\logo.png' width=465 height=100 />"

_IEBodyWriteHTML($ieWin, $webStr)
Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Deathbringer:

That code doesn't work for me. I used it exactly as you gave it (after I saved the logo.png to C:\). There is still no image being displayed, even though this HTML works ok on its own.

(Perhaps related/perhaps not: the _IE functions work OK for me but none of the _INet functions work on this box, though my drivers otherwise seem fine. I wonder if that's relevant at all to how AutoIt handles the IE windows/objects it creates...Just thinking out loud).

Share this post


Link to post
Share on other sites

enaiman:

The workaround actually does work. Thank you.

So what is it about the workaround that allows the image to appear though the generated HTML window can't do this? I wonder...

Thanks again, and Happy Christmas.

Share this post


Link to post
Share on other sites

I have absolutely no idea why this is happening. I had a look at the IE.au3 hoping to get an idea but there isn't much to find.

I'm glad you're happy with the workaround, till a fix comes (if there is a fix), it's working :x


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0