fulliautomatix
4th March 2009 17:47 UTC
How to Pause and Resume
i want to make a installer (i.e.)download manager, which will in-turn download my exe from net and install it. As the .exe is huge, i want my clients to pause the download and resume it.
i found nsisdl supports the resume function. but i am still unclear with it (as u close installer, open it again and it will try to find the diff between the downloaded exe and the one from the net and download the remaining, which i bet no one can understand on the client side).
So anyone have a clear code for this, might be a great help.
Thank you in advance.
Collector9999
9th March 2009 04:21 UTC
I think that ExecWait is what you are looking for.
MessageBox MB_YESNO "Your message box text here. (Note: you must be connected to the Internet.)" /SD IDYES IDNO endNetInstaller
SetOutPath "$TEMP"
NSISdl::download URL_to_file/installer.exe "$TEMP\installer.exe"
ExecWait "$TEMP\installer.exe"
Delete "$TEMP\installer.exe"
Goto endNetInstaller
endNetInstaller:
Animaether
9th March 2009 06:40 UTC
no, he wants to be able to stop/resume a download
I'm not sure where you get that nsisdl supports resume downloads, fulliautomatix - as far as I can tell, it doesn't.
Nor do inetload and inetc (pretty much the same plugins).
Metadl does support it (just tested):
http://nsis.sourceforge.net/Metadl
However, Metadl - like nsisdl - can only show progress if used inside a Section. So the only way for you to 'pause' the download is to cancel installation altogether. You could set a variable if the cancel reason is due to the download and leave some of your installation up to that point intact, I suppose.
Better would have been if it had been able to pop up a dialog as then you could use it on custom pages, but since you were using nsisdl anyway, this might not be an issue for you.
Outfile "test.exe"
Page Instfiles
Section ""
metadl::download "http://www.cs.cornell.edu/~tedkim/WTURB/wlTurb_video.mov" "$temp\awesome.mov"
Pop $0
MessageBox MB_OK "[$0]"
SectionEnd
Animaether
9th March 2009 06:55 UTC
Okay, slight update... I now see where you get the 'nsisdl resume' thing. That's from a modified version which, as far as I can tell, isn't in the official distribution (yet?)..
From this thread...
http://forums.winamp.com/showthread.php?threadid=275862
...grab this archive...
http://forums.winamp.com/attachment.php?postid=2228818
...and then try a script set up as follows:
Outfile "test.exe"
Page Instfiles
Section ""
nsisdl::download /RESUME /NODELETE "http://www.cs.cornell.edu/~tedkim/WTURB/wlTurb_video.mov" "$temp\awesome.mov"
pop $0
MessageBox MB_OK "[$0]"
SectionEnd
Basically the way that modified nsisdl works is that you have to tell it to -not- delete the existing file on failure - so that it remains for resuming, and tell it that you want to resume download (valid even if the file doesn't exist yet, looks like).
fulliautomatix
19th April 2009 10:10 UTC
thank you
thank you Animaether.
pengyou
20th April 2009 10:07 UTC
The documentation for the Inetc plugin (http://nsis.sourceforge.net/Inetc_plug-in) says it has a resume option
/RESUME
On the permanent connection/transfer error instead of exit first displays message box with "resume download" question. Useful for dial-up connections and big files - allows user to restore connection and resume download. Default is "Your internet connection seems to have dropped out!\nPlease reconnect and click Retry to resume downloading...".