Jump to content

_IEDocWriteHTML can't create images


RealisT
 Share

Recommended Posts

#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?

Link to comment
Share on other sites

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 :)

Link to comment
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).

Link to comment
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 :)

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