weebib
26th May 2003 19:49 UTC
NSIS dialog problem
Hello to all,
I just completed my first install with NSIS. It is almost working. I still have a small problem though.
My program is a Java program so I have to verify/install the correct version of the JRE. To that effect, I have created a custom page which calls the function SetCustomJRE. After various verifications (is there a JRE installed, if not is there a JDK installed, if so is the version number compatible...), the installer eventually prompts the user with the custom page, thus displaying the problem message. The user just has to press Next to install a JRE. (So to answer future questions, there has been at least one window displayed at that time.)
Once the next button is pressed, I launch the download process of the correct JRE (sun's package j2re-1_4_1_02-windows-i586-i.exe).
What happens is that the download succeeds but no window appears. As I am still testing, I put the corresponding file on a web server within my local area network. Still, the file is 10MB so it really takes a few seconds during which the user does know what is going on.
Any help welcome,
Thanks in advance,
Weebib
kichik
26th May 2003 20:01 UTC
Welcome to the forum.
NSISdl is not designed to run from within custom page's creator functions. It can only be used in sections unless used in silent mode (NSISdl::download_quiet).
You'd have to move the download code into a section and leave some information in parameters for that section so it can know what to download.
weebib
26th May 2003 20:16 UTC
Thank you for your quick answer.
I was actually afraid you'd say that.
So let me see if I get it right :
- I need to create a section in which I will place the download code
- When I have determined that a download is necessary I put a flag in a global variable such as $9 for instance.
- In my SetCustomJRE, I test the value of $9 and run the download if necessary.
My only trouble is to know when this section will be called. How can I ensure it will run before the License page for example, or at least run before the actual installation of my program since the success of the JRE installation is necessary.
Thanks in advance,
Weebib
kichik
26th May 2003 20:26 UTC
You have two options:
1) Create another installer that will show the custom page, download JRE and install it. Call this installer from .onInit of the main installer.
2) Put two instfiles pages, and add a hidden section (Section "" or Section "-namedoesntmatter"). In the pre function of the first instfiles page disable every section but the hidden JRE section and then it will be the only one that will execute, and in the pre function of the components page disable that hidden section and re-enable all of the others. If you don't have a components page do it in the pre function of the second instfiles page or any other script block that is executed before the second instilfes page starts executing sections.
kichik
26th May 2003 20:44 UTC
On second thought, it would be better to set the sections back to normal on the leave function of the first instfiles so if you have pages before the components page/second instfiles the user's selection won't be overridden.
Example attached.