[Help] Download progress? - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: [Help] Download progress? (/showthread.php?tid=84618) [Help] Download progress? by SmokingCookie on 07-01-2008 at 02:12 PM
Hi, RE: [Help] Download progress? by Basilis on 07-01-2008 at 02:15 PM
There is a control that displays a bar in the window which is like downloading but not like displaying a progress. RE: [Help] Download progress? by mynetx on 07-01-2008 at 02:18 PM 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). RE: [Help] Download progress? by SmokingCookie on 07-01-2008 at 02:19 PM
Okay, that's an option for a known file.. But it won;t be possible for unknown OutFile's.. quote: 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 . RE: [Help] Download progress? by CookieRevised on 07-01-2008 at 09:33 PM
quote: 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. RE: [Help] Download progress? by SmokingCookie on 07-02-2008 at 07:42 AM
Okay, then I'll do that. RE: [Help] Download progress? by CookieRevised on 07-02-2008 at 06:08 PM
quote: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? ) RE: [Help] Download progress? by Matti on 07-02-2008 at 06:16 PM
quote:Something like a OnEvent_DownloadFileProgress(Url, OutFile, BytesDownloaded, BytesTotal) would be nice, yes. Go and bug Patchou about it! RE: [Help] Download progress? by SmokingCookie on 07-02-2008 at 07:26 PM 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.. RE: [Help] Download progress? by CookieRevised on 07-02-2008 at 07:39 PM
Timers can be triggered extremely quickly to though.... RE: [Help] Download progress? by SmokingCookie on 07-02-2008 at 07:46 PM
I've been considering this too, but I haven't seen any possibility (yet). RE: [Help] Download progress? by Eljay on 07-02-2008 at 07:53 PM
quote: code: Doesn't always work though, depends if the header is sent (only seems to be sent on static files). No other way of getting the size before downloading that I know of... RE: [Help] Download progress? by CookieRevised on 07-02-2008 at 08:11 PM
I just was looking around too, and found roughly the same thing. However, it should be done with readyState 3, not with 4.... (as 4 is triggered when done)? code: RE: [Help] Download progress? by Eljay on 07-02-2008 at 08:16 PM
quote: That's with a full GET request with the whole file, my code is sending a HEAD request which doesn't download the whole file but just the headers. I tried it in readyState 3 just in case and it throws a very descriptive "Unspecified error" It seems the response (getResponseHeader, responseText etc.) can't be accessed until the request is complete? ----- Edit: found this: quote: The remarks also provide a couple of possibilities that could be used, I shall experiment further RE: [Help] Download progress? by SmokingCookie on 07-03-2008 at 07:51 AM
@ CookieRevised: code: Debugger says "> 261048" and Windows' "Properties" window: "261.048 bytes".. Seems to work perfectly RE: [Help] Download progress? by CookieRevised on 07-03-2008 at 11:44 PM
quote:Very important actually. Mozilla and MSIE have the xmlhttp object implemented differently. I thought the code was for MSIE, showing an alternative way for something you could do in Mozilla.... I guess it was the other way around.... That's what you get when you're hasty , sorry... quote:cool... ServerXMLHTTP seems promissing a first sight. the IXMLHTTP object needs a language to be set for viewing webpages in order to work if I read it correctly. RE: RE: [Help] Download progress? by SmokingCookie on 07-04-2008 at 07:28 AM
quote: Woo, I've been smarter than CookkieRevised for the first (and the last) time in my life Anyway, I have inserted Eljay's code and it works now RE: [Help] Download progress? by Matti on 07-04-2008 at 08:58 AM
quote:Yes, that ServerXMLHTTP thingy looks interesting, as the readyState property will only be set to 2 (LOADED) when the headers are already loaded, in contrast to the 'normal' XMLHTTP request where the LOADED state is set directly after send() is called. The ServerXMLHTTP also allows us to get partial data during the process... I think I'll give this a try today. EDIT: Okay, it doesn't work. The only way to get the partial data is through either the responseStream or responseBody properties, which are not supported by the JScript environment. If I try to get those properties, I get the following (Dutch) error: quote:which means: quote:The responseText and responseXML properties aren't given any value during interactive mode, so they give the same error. This is quite sad, because it would have opened very interesting possibilities for scripting. RE: [Help] Download progress? by mynetx on 10-01-2008 at 09:41 AM Because other methods are not working (as experimented in this thread), I have brought in a suggestion for a MsgPlus.DownloadFile enhancement. RE: [Help] Download progress? by CookieRevised on 10-04-2008 at 08:51 AM You can get partial downloads by using the APIs of WININET.DLL directly. I've done this a long time ago in a big Excel project, which I completely forgot about. |