Sign in to follow this  
Followers 0
timmalos

IE, How to know if image is loaded

5 posts in this topic

Hey.

During my simulation with IE.au3, i need to check that an image is fully loaded. It's created with PHP and it's dynamic.

I can't show u exactly the website cause it's internal only, but it's the same thing as:

http://usb-online.fr/file-download-c30MTA0Mg.html

So it's an image, and i want to know if it's loaded or PHP answered error.

I don't really know how to do.

First thing i thought was to try to get the weight of the image. For example in IE i can Right Click, Properties, and there is a line Weight=XXXX octets

Maybe the size would be nice too, so do you know how i can access these informations with IE.au3 without InetGet the link?

Maybe i can insert javascript in head to return the size?

This is what i tried :

#include <IE.au3>
$oIE = _IECreate("http://usb-online.fr/file-download-c30MTA0Mg.html")
$openfile = FileOpen(@ScriptDir & "\image.jpg", 2)
Filewrite($openfile,_IEPropertyGet($oIE,"innerhtml"))
FileClose($openfile)

But Ie wants to download the file or displays <img src="http://usb-online.fr/file-download-c30MTA0Mg.html"/>

Thx for advises,

Tim

Share this post


Link to post
Share on other sites



The link you provide attempts to download an image to disk, after answering a download prompt. The questions you ask are about an image being fully loaded in the browser. You'll need to describe your scenario better before we can help.

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

Share this post


Link to post
Share on other sites

Sorry for this, bug in my website. Now it works : http://usb-online.fr/file-download-c30MTA0Mg.html

I want to know if this image is well displayed on the page.

Share this post


Link to post
Share on other sites

Something about the test page you've created results in a page with different content based on whether the URL is typed in manually or if the page is created with _IECreate()

manual:

<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY><IMG src="http://usb-online.fr/file-download-c30MTA0Mg.html" width=677 height=384></BODY></HTML>

_IECreate():

<HTML><HEAD></HEAD>
<BODY leftMargin=0 scroll=no topMargin=0><EMBED height="100%" type=image/x-png width="100%" src=http://usb-online.fr/file-download-c30MTA0Mg.html fullscreen="yes"></BODY></HTML>

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

Share this post


Link to post
Share on other sites

I found a solution so here it is.

You just have to use the .complete property of the image to know if it's fully loaded.

$oImage = _IeGetObjByName($oIE,"myImage")
if ($oImage.complete) Then ...

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