Skip to content
⌘ NSIS Forum Archive

http + ftp download plug-in

545 posts

polygonansigt#
Originally posted by Takhir
Multiple download sample was tested many times. In your script NSIS might put $test as a single string to stack. Please test "long" command line first (without strcpy) and check exit code.
I didn't realize the way the commandline and the stack worked. You were correct that $test was put onto the stack as a single line. I managed to get it to work by push'ing the data to the stack in a loop and calling InetLoad::load /popup to have it pick up the parameters from the stack. Seems to work like a charm :-) Thanx for pointing me in that direction.

Regards
pedroac#
Hi everybody

Is there a way to make the dialog freeze while the download is being made?

Currently, the download uses the proxy settings correctly, but the user is able to press "Back", "Next" and "Cancel" and I don't want it to happen.

Any idea?
Thanks in advance
Afrow UK#
You can disable the buttons yourself with GetDlgItem and EnableWindow:

GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
GetDlgItem $R0 $HWNDPARENT 2
EnableWindow $R0 0
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0

This will disable all three buttons.

-Stu
stone_j#
Hi.
I'm getting faimilar with inect but I have one questiona, as I cant find answer for it. Is it possible to upload on serwer whole directory structure?
Thanks for help
Takhir#
Nope, .NET not required. Functions are classic dll entry points (__far __pascal == WINAPI). But you can build project under VS 2005 as well - no difference with VS 6.
rjch_au#
Just got a quick question... I'm using an NSIS installer with the inetload plugin (bloody wonderful plug-in that it is!) to reduce the pain involved in upgrading software on several hundred machines by having the installer download the necessary updates - one of which is the dotNET framework - all 23mb of it. Dialup sites have a bad habit of regularly failing to the point that they can never finish the download in one go.

I'm trying to use the following line of code to silently download (with resume) the update, but in silent mode, resume does not seem to work. It works fine in normal mode, but the problem is that there *isn't* someone watching the machine to click the Retry button.

inetload::load /resume "" /silent "Downloading dotNET framekwork..." /popup "Downloading..." "http://172.25.254.151/appupdates/updatepacks/dotnetsilent_adbox.exe" "$OUTDIR\dotnetsilent_adbox.exe"

Can anyone give me any ideas how I might resolve this problem?
Takhir#
Try to comment line 976 in InetLoad.cpp source code and rebuild project, should be (not tested)

// if(silent) resume = false;
rjch_au#
Thanks for your quick suggestion Takhir, however I'm now running in to a problem previously posted on the forum that I can't spot a solution for - namely, I'm getting the following compile errors:-

error C2365: 'FtpCommandA' : redefinition; previous definition was a 'function' (@ line 64)
C2659: '=' : overloaded function as left operand (@ line 633)

C++ isn't my specialty - I *can* program, but it's not what I do for a living and for that reason, whenever I need to knock something together I either use NSIS or VB.
Takhir#
Just replace FtpCommand with myFtpCommand, use "whole word" option on replace. It is important for this line:

myFtpCommand = (FTP_CMD)GetProcAddress(hInstance, "FtpCommandA");
Takhir#
Is it possible to RESUME download of already existing file?
No. Please use 4.9.4.10 IfFileExists jumps to handle the situation.
********#
That's a pity even though inetc is not a download manager. Still there is another bug not connected with RESUME:

When inetc is called in .onInit installer window is started in background and BringToFront doesn't work afterrwards.

The command used is

inetc::get  "http://www.mingw.org/mingw.ini" "$EXEDIR\\mingw.ini" /END 
Takhir#
NSIS BringToFront manual notes this new OSes behaviour. Use /banner or /popup to keep focus.
********#
I haven't found the instructions. It is said that
If an application was executed that shows itself in front of the installer, a BringToFront would bring the installer back in focus.
But AFAICU there is not separate application executed. In fact the inetc command above is meant to be launched with /SILENT key for quick check if there is a newer version of installer available. Maybe it is possible to do something so installer will not lose the focus?
Takhir#
4.9.14.1 BringToFront
...
Recent Windows versions restrict the setting of foreground windows. If the user is working with another application during installation, the user may be notified using a different method."


Finally this means that none of SetForegroundWindow, SetActiveWindow, SetWindowPos can sets window to foreground and give it keyboard focus (now). Taskbar button flashes instead. But Inetc sources include commented sf() function - this worked but was removed later. You need to call this directly from installer, may be using System plug-in.
********#
Still can't get the logic. Installer does not execute any external programs to lose focus - it merely calls a function from DLL. In addition I do not have any recent windows version (W2K only), so this should work for me, but BringToFront doesn't work after a call to inetc.

Maybe there is a misconception in inetc which tries to operate with some of its windows even with the /SILENT switch - this causes installer to lose focus to these windows and they fail to return it back? Could this be possible?
Takhir#
This is not Inetc related problem, the same (under some conditions) happen with splash windows, banners and even outside NSIS 😉 http://forums.winamp.com/showthread....t=BringToFront
Please use forum search - you are not first 🙂 and most of questions already have answers..
dannyoneill#
Hi, Im having a few problems, when i run my download installer I dont receive a dialog box with the download progress. However I did with the older version in the quote below. The latest one does download the file but totally silent.

My line reads as follows

InetLoad::load ${PDFURL} $PROGRAMDIRECTORY\CoolPDF.exe

As I said, it worked fine with older versions but the latest just doesnt show any progress.

Thanks


Originally posted by Takhir
It�s not easy to debug program if you cannot touch the problem with your own hands J
I made one minor improvement for error 407 (proxy authorization), might be good to test it. But the main question is in explicit proxy authorization if IE registry parameters (already used) are not enough for connection. This require user_name and password. I see 2 simple ways to resolve the problem, silent InternetSetOption(INTERNET_OPTION_PROXY_PASSWORD + INTERNET_OPTION_PROXY_USERNAME) if these parameters presents in the plug-in call (something like �load /PASSWD=passwd ��) or popup dialog (InternetErrorDlg for example), where user can enter name and passwd for proxy auth (not works in the silent mode). Both variants may present in program, of course. First is good for corporate network distribution, second � for Inet downloads. If this is what you need � I�ll be in office in Monday and can make changes next week.
Also few words about http server authorization (error 401) � it is possible to define name and password in the URL, program extracts both parameters (if any. I did this for FTP if anonymous user is not accepted).
Takhir#
I re-tested InetLoad and could see correct download progress (Nov 4 2006 version, XP Pro). You can download and test old version from http://nsis.sourceforge.net/File:InetLoad.zip or try to use Inetc - function name is get (Inetc::get) and embedded dialog code was improved there.
dannyoneill#
Its weird, use the old version in the post above and all works, use the latest and it just wont show.

Do I need any other commands to make it show or should

InetLoad::load ${PDFURL} $PROGRAMDIRECTORY\CoolPDF.exe

work?

Thanks
Takhir#
I compared last source with March 12, 2006 version and don't see any related code changes. What is your 'old' version? And (again 🙂 ) Inetc behaviour is more stable in old (NSISdl) display mode.
In your code following might be better (the same for Inetc)

InetLoad::load ${PDFURL} "$PROGRAMDIRECTORY\CoolPDF.exe" /end
Pop $R0
Backland#
dannyoneill,

Are you by any chance making multiple calls to the plugin? e.g. downloading more than 1 file.
dannyoneill#
at the moment im downloading one then later another. But I have tried it with just one file. Old plugin fine, new one nope.

I can make the full script available if thats of any help. Its for CoolPDF Portable.
Backland#
hmmm... I have had similar problems with Inetc and downloading more than 1 file where the progress is not displayed at all.

Attaching your script is probably a good idea.