Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th February 2010, 00:25   #1
realpuff
Junior Member
 
Join Date: Jun 2009
Posts: 2
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
realpuff is offline   Reply With Quote
Old 17th February 2010, 16:46   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
I you'd read the inetc readme you'd know that it returns OK on success and not an empty string.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump