[Help] Download progress? |
Author: |
Message: |
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. [Help] Download progress?
Hi,
I am wondering if there is a way to monitor a file's download progress.
Since MsgPlus.DownloadFile() can't do this, I am looking for other ways to download a file, perhaps even with an XMLHTTP request (but there's probably some function in the Windows API, that's unknown to me ).
So, is there any way to monitor download progresses as IE and FireFox do?
Thanks in advance.
|
|
07-01-2008 02:12 PM |
|
|
Basilis
Veteran Member
Olympiacos CFP
Posts: 1366 Reputation: 46
31 / /
Joined: Dec 2007
|
RE: [Help] Download progress?
There is a control that displays a bar in the window which is like downloading but not like displaying a progress.
Here it is:
<Control xsi:type="ProgressControl" Id="Example">
<Position Top="5" Width="100" Left="0" Height="10"/>
<Marquee/>
</Control>
This post was edited on 07-01-2008 at 02:21 PM by Basilis.
|
|
07-01-2008 02:15 PM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
RE: [Help] Download progress?
Call the MsgPlus.DownloadFile with a OutFile parameter that you know, and then check the filesize of the OutFile, based on a timer (FSO object, GetFile method, Size property).
|
|
07-01-2008 02:18 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [Help] Download progress?
Okay, that's an option for a known file.. But it won;t be possible for unknown OutFile's..
EDIT::
Here's what I'd like to do:
quote: Originally posted by Basilis
There is a control that displays a bar in the window which is like downloading but not like displaying a progress.
Here it is:
<Control xsi:type="ProgressControl" Id="Example">
<Position Top="5" Width="100" Left="0" Height="10"/>
<Marquee/>
</Control>
Yes, that's that nice progress bar in IE which makes my PC freeze up
However, Microsoft has been so nice not to write an easy function to detect progresses .
This post was edited on 07-01-2008 at 02:21 PM by SmokingCookie.
|
|
07-01-2008 02:19 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: [Help] Download progress?
quote: Originally posted by SmokingCookie
However, Microsoft has been so nice not to write an easy function to detect progresses .
just some quick thoughts without checking things first:
I very much doubt that there is an API like that which shows how much percent/ratio is completed. What maybe might exist is a callback function which reports back how many bytes have been saved so far or something.
But:
- You can't use such callbacks in Messenger Plus! anyways since they will be more than likely asynchronous callbacks.
- You still need to know the size of the complete file in order to be able to show a progress bar (which is always in the form of a ratio: x out of y, or x green/blue bars out of a total of y bars).
What you could do instead is showing a 'busy' indicator to the user. In that way the user still wont be able to see how much longer it will take, but he would be able to see that the script is still busy downloading. As a bonus you could also show the amount of bytes already downloaded, which is another good indication that the script is still busy doing usefull stuff instead of being in a dead-loop or been froozen.
This post was edited on 07-01-2008 at 09:39 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
07-01-2008 09:33 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [Help] Download progress?
Okay, then I'll do that.
However, one CAN make a progress bar indicating the readyState of an XMLHTTP request. Example:
Debug.Trace("> " + (25 * XMLHTTP.readyState));
This will go no further than 100%, so it's possible to indicate what the script is doing (sending request, receiving headers etc.)
|
|
07-02-2008 07:42 AM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: [Help] Download progress?
quote: Originally posted by SmokingCookie
Okay, then I'll do that.
However, one CAN make a progress bar indicating the readyState of an XMLHTTP request. Example:
Debug.Trace("> " + (25 * XMLHTTP.readyState));
This will go no further than 100%, so it's possible to indicate what the script is doing (sending request, receiving headers etc.)
yep, but that is of course not really a progress bar either. The user usually wants to see the progress of the actual downloading (readyState 3), not the usually very fast initializing....
But it is way better than nothing of course....
(Do I smell a suggestion for the MsgPlus.DownloadFile() function here? )
This post was edited on 07-02-2008 at 06:08 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
07-02-2008 06:08 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: [Help] Download progress?
quote: Originally posted by CookieRevised
(Do I smell a suggestion for the MsgPlus.DownloadFile() function here? )
Something like a OnEvent_DownloadFileProgress(Url, OutFile, BytesDownloaded, BytesTotal) would be nice, yes. Go and bug Patchou about it!
|
|
07-02-2008 06:16 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [Help] Download progress?
That certainly is a good idea .. But at high download speeds, this event would be triggerd.. Many times (like an infinite loop). And I'm not even talking about big files being dowloaded at high speed..
|
|
07-02-2008 07:26 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: [Help] Download progress?
Timers can be triggered extremely quickly to though....
Then again, it could be solved a bit by adding a packet size parameter to DownloadFile() (or new downloadfile function) to tell Plus! to trigger DownloadFileProgress() each x bytes.
-------
Anyways, can't you just make something with some kind of ActiveX object or whatever. I mean, when you download a file with your browser, it usually tells you also how big the file is and thus being able to show you a progress dialog. So, find out how they do that (probably sending some kind of request first) and do the same in your script.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
07-02-2008 07:39 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|