Archive: Inetc problem


Inetc problem
Hi everyone,

I tried to create an downloader using inetc::get but my code need to be fixed so I need your help!

I have 2 download locations (links) and first one acts as main download link and the second one as backup just in case the first download link go down.

Now I want my script to check link1 and if there error maybe due that user use a proxy then check link1 again with /NOPROXY and if file not found, link1 down or any error then I want to check link2. My code works but when the working link is found and the file is downloaded, this not run because I don't know how to set a condition that when link is working and file downloaded then the script to jumt to the Function .onGuiEnd instead execute the remaining code and try to download again. Here is my code:


SetCompressor LZMA
WindowIcon Off
CRCCheck On
AutoCloseWindow true
ShowInstDetails nevershow
ShowUnInstDetails nevershow
RequestExecutionLevel highest

!define NAME "Downloader"
Name "${NAME}"
OutFile "Downloader.exe"

!include "MUI.nsh"
!define MUI_ICON "Setup.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Downloading file"
SetDetailsView hide

inetc::get /NOPROXY "http://www.mydomain1.com/Setup.exe" "$PLUGINSDIR\Setup.exe" /END
Pop $0

${If} $0 != ""
inetc::get "http://www.mydomain1.com/Setup.exe" "$PLUGINSDIR\Setup.exe" /END
Pop $1

${If} $1 != ""
inetc::get /NOPROXY "http://www.mydomain2.com/Setup.exe" "$PLUGINSDIR\Setup.exe" /END
Pop $2

${If} $2 != ""
inetc::get "http://www.mydomain2.com/Setup.exe" "$PLUGINSDIR\Setup.exe" /END
Pop $3

${EndIf}
${EndIf}
${EndIf}
SectionEnd

Function .onGUIEnd
SetOutPath $PLUGINSDIR
Exec "Setup.exe"
FunctionEnd


I you'd read the inetc readme you'd know that it returns OK on success and not an empty string.

Stu