RealisT Posted December 21, 2010 Posted December 21, 2010 #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?
enaiman Posted December 21, 2010 Posted December 21, 2010 For once, I don't see any end to the image tag ... </img> That is not AutoIt related 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 :)
RealisT Posted December 21, 2010 Author Posted December 21, 2010 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.
enaiman Posted December 21, 2010 Posted December 21, 2010 (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 December 21, 2010 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 :)
RealisT Posted December 21, 2010 Author Posted December 21, 2010 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).
enaiman Posted December 21, 2010 Posted December 21, 2010 See my updated post. 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 :)
RealisT Posted December 21, 2010 Author Posted December 21, 2010 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.
enaiman Posted December 21, 2010 Posted December 21, 2010 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 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 :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now