Reputation: 257
I've got NSIS code like this:
;Installer Sections
var /GLOBAL f1m
Function GetXML
StrCpy $path "/A/B/C/"
StrCpy $path "$path$R1"
${UpdateXml} "http://127.0.0.1/denwer/update.xml" $path $f1m
FunctionEnd
Function DownloadFiles
metadl::download /RETRYTIME=2 /MAXTRIES=2 /MD5 $f1m http://127.0.0.1/some.exe some.exe
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Download failed: $R0"
FunctionEnd
Section "Dummy Section" SecDummy
...
ReadRegStr $curver HKCU "Software\SomeSoft" "ver"
...
${For} $R1 1 10
Call GetXML
Call DownloadFiles
${Next}
...
SectionEnd
When programm in for loop runs "DowloadFiles" function it's back not in the begining of for loop. It's just back to ReadRegStr command and always gets same value of $f1m variable and stuck on a loop.
What's the cause of this action?
Upvotes: 0
Views: 610
Reputation: 101756
Jumping past a functions end is not supported/undefined. You should consider using labels or LogicLib.nsh...
Upvotes: 1
Reputation: 11465
In your DonwloadFiles
function, I see a dubious
StrCmp $R0 "success" +3
That should jump to the 2nd next statement if the strings are equal (+1
is the next statement, +2
let shortcircuit the next statement, and +3
will shunt the next 2 statements).
But there is only one statement after the StrCmp
: the MessageBox
. It is probable that when the strings are equal the flow is jumping to an unexpected statement... Use +2
to jump over the message box, or use a label to avoid surprises.
Upvotes: 1