Archive: HowTo: show webpages within sections?


HowTo: show webpages within sections?
I want to be able to have several sections that allow the person doing the install to optionally see web-pages. This almost works ok with ExecShell, but I don't see how to accomplish a "wait" ... the net result is that use of ExecShell doesn't wait between sections.

I can use ExecWait, but nothing shows up. I suppose I could track down where the end-user has their web-browser installed and invoke that, but that seems flawed and I was hoping for a simpler approach.

I didn't see how to do this in the documentation or examples. Did I miss something?


;Name and file
Name "Demo of ExecShellNoWait problem"
OutFile "ProblemSetup.exe"

;Default installation folder
InstallDir "$TEMP\Problem"

Page directory
Page components
Page instfiles
;--------------------------------
;Installer Sections
Section "Some Page With ExecWait"
ExecWait "http://www.yahoo.org"
SectionEnd

Section "Another Page with ExecWait"
ExecWait "http://www.msn.org"
SectionEnd

Section "Another Page With ExecShell"
ExecShell "open" "http://www.yahoo.com" ; works but does not wait
SectionEnd

Section "Another Page with ExecShell"
ExecShell "open" "http://www.msn.com" ; works but does not wait
SectionEnd

Section /o "Show Variables MB"
MessageBox MB_OK "SMPROGRAMS: $SMPROGRAMS $\r$\n \
Temp: $TEMP $\r$\n \
StartMenu: $STARTMENU $\r$\n \
QuickLaunch: $QUICKLAUNCH $\r$\n \
Documents: $Documents $\r$\n \
SmStartup: $SMSTARTUP"

SectionEnd

;--------------------------------
;Uninstaller Section
Section "Uninstall"
RMDir /r "$INSTDIR"
SectionEnd

I don't think you can actually directly do what you want- i.e., open a web page and wait for the user to close it before continuing. Since the browser is not a console process, I don't think that any of the NSIS exec functions can wait for it.
You might want to use FindWindow to find the browser window and then sleep & loop until is is closed.
Or maybe create a plug-in DLL similar to InstallOptions which lets you embed the web page into the installer window?
ExecWait needs you to provide an executable. Just providing the URL is not enough. And even if you provided the path to the browser exe, it probably won't work.


2 other options to think about would be to simply add a MessageBox after the WebPage call, that says something like "Click OK to continue the install". Or you could check out a cool program called AutoIt (http://www.hiddensoft.com/AutoIt), which has very good wait/logic commands. Hope this helps.

Jnuw


Originally posted by iceman_k
And even if you provided the path to the browser exe, it probably won't work.
Attached script works on my comp (tested with IE). Please note AutoCloseWindow true parameter.

"Ask and ye shall receive." :D

Both suggestions in the previous posts seem to work. (although I've only briefly checked the 2nd with WinXp-Sp2 ... makes me wonder about other/earlier o/s such as Win98 and with other browsers)


Section "Another Page with ExecShell"
ExecShell "open" "http://www.msn.com" ; works but does not wait
MessageBox MB_OK "Please click on OK to continue the installation"
SectionEnd

Section "Try ShellOpenCommand"
ReadRegStr $0 HKCR "htmlfile\shell\open\command" ""
ExecWait '$0 http://www.google.com'
SectionEnd


BTW ... Takhir ... your script has nsis.sourceforge.com

Boy, was I wrong! :o
That'll teach me to try something first before saying it can't be done. :D


The "ShellOpenCommand" approach seems to work ok with Win2000 (not a surprise) and ...

drum-roll please ...

ok with Win98-First Edition using IE 4.72.3110 (IE which came with Win98-FE)

Not bad :D

Somewhere, I've got a whole "suite" of old NetScape browsers, and will maybe check them. But I suppose that would involve changing the default browser setting.


This even works with Win95 Gold - last version without IE. Was tested with a full set of browsers for http://www.imageplayer.net (few years ago). NS 4.7 specifics not touches this situation.
Might be a bit better to check HKCR .html file type in registry first, but this is optional, because type is htmlfile :)