Archive: drop-down popup during download?


drop-down popup during download?
is it possible to display a drop-down popup containing e.g. alternative mirrors during a download?

say if a download fails, because the current mirror used is down. the user might want to change mirror without restarting setup.


Could be something like this (4th server is the good one),

!define INI "$PLUGINSDIR\custom.ini"

outfile 'nsisdl.exe'

page custom cte lve
page instfiles "" "" ilve

Function .onInit
InitPluginsDir
WriteINIStr "${INI}" "Settings" "NumFields" "1"
WriteINIStr "${INI}" "Settings" "NextButtonText" "Download"
WriteINIStr "${INI}" "Field 1" "type" "DropList"
WriteINIStr "${INI}" "Field 1" "left" "10"
WriteINIStr "${INI}" "Field 1" "right" "-10"
WriteINIStr "${INI}" "Field 1" "top" "30"
WriteINIStr "${INI}" "Field 1" "bottom" "78"
WriteINIStr "${INI}" "Field 1" "state" "http://nsis.sourceforge.net/nihtgly/nsis.zip"
WriteINIStr "${INI}" "Field 1" "listitems" "http://nsis.sourceforge.net/nihtgly/nsis.zip|\
http://nsis.sourceforge.net/nitghly/nsis.zip|http://nsis.sourceforge.net/nihgtly/nsis.zip|\
http://nsis.sourceforge.net/nightly/nsis.zip"
FunctionEnd

Function cte
InstallOptions::Dialog "${INI}"
FunctionEnd

Function lve
ReadIniStr $0 "${INI}" "field 1" "state"
Functionend

Function ilve
Strcmp $R0 "back" 0 end
SendMessage $HWNDPARENT "0x408" "-1" "0"
Abort
end:
Functionend

Section "dummy"
NSISdl::download "$0" "$EXEDIR\nsis.zip"
Pop $0 ;Get the return value
StrCmp $0 "success" good
MessageBox MB_YESNO "Download failed: $0$\r$\nSelect another mirror?" IDNO good
Strcpy $R0 "back"
goto end
good:
Strcpy $R0 ""
end:
Sectionend

RedWine, what does this do?

SendMessage $HWNDPARENT "0x408" "-1" "0"
I don't see 0x408 in WinMessages.nsh

will that just select the next server in the mirror list?


Originally posted by empezar
will that just select the next server in the mirror list?
The simplified above example, if download fails, just jumps back to the previous page
where users are able to select a different mirror from mirrors list.

See here for details about jump to a page.

Just compile it and run it to see how it works.
I guess if you play a little with it, you should be able
to make it select automatically the next mirror from the list.

when I jump back 3 steps to the mirror selection, and then press Next and get the same error, aborting will not jump back to the mirror selection page, but to the license agreement (another 3 steps backwards), and when I click Agree there, and press abort again, it will cancel the installation.

so the problem seems to be this

Display welcome screen
Display license agreement
Select components
Select mirror
Select installation path
Select start menu folder
Install -> Click Abort
Go back 3 steps to "Select mirror"
Install -> Click Abort
Go back 3 steps to "Display license agreement"

so, how do I "reset" the page so once I select a mirror for the second time and it still fails, I won't go back ANOTHER 3 steps, but back to the mirror selection?

another related question: how do I go back in sections? I mean, if a download fails and a user chooses to try a different mirror, the installer should not abandon that section and try the new mirror with the next section, it should RETRY the current section with the newly selected mirror.


Probably this needs 2 instfiles pages 1st for download section and 2nd for all other selected sections when download success.
I suppose select mirror page should reside just before the 1st instfiles page and right after the 2nd instfiles.