|
|
#1 |
|
Junior Member
Join Date: May 2006
Posts: 3
|
Passing data through to !included files
I have a set of similar installations based on one common NSIS script. Mostly the same fileset, but a different main exe, different product name, different Start Menu name, etc. (i.e. different versions for different customers).
I use an external script to swap in the appropriate exe to a standard name before running the script. I have tried using 2 nsi files, as follows... product1.nsi !define APP_NAME "Product1" !include "common.nsi" And common.nsi then uses APP_NAME for the Name, install dir, StartMenu naming, etc. But, APP_NAME doesn't seem to carry through to the second file. It only works if I define it in common.nsi. Any hints on how to make this work, or different ways of doing this? I've tried using a Var, but it doesn't seem to work either. I can define "Name" in product1.nsi, and it carries through to common.nsi, but that doesn't do everything I need it to do. |
|
|
|
|
|
#2 |
|
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
compile common.nsi and use a header with all needed info.
i.e. !include header.nsh where header.nsh could be like this: !define APP_NAME 'my app' !define VERSION '1.5.0.0' !define MAIN_EXE 'c:\temp\myapp.exe' etc Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: May 2006
Posts: 3
|
Thanks for the reply.
I don't understand how using a header file allows me to select at compile time which values to use. I would have to somehow selectively include one of several different .nsh files, or write several common.nsi files to include the different headers, which defeats the whole purpose of common.nsi. My external shell script knows about the different versions, but how can this information be handled in the NSI scripting? The shell script can copy the appropriate product1.nsh or product2.nsh to a standard name, product.nsh, and common.nsi can include product.nsh, but surely there's a nicer way...? |
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
One thing that I do is create a separate EXE using an NSIS script that generates an custom page that asks the user options he/she wants to use. This EXE would then create a header file on the fly.
Then, in your main script, add the following lines of code: code: The attached sample script helps illustrate the header creation file. Anther option: Pass a define using the '/d' command on MakeNSIS.exe and then use !ifdef blocks for each of your products. For more ideas, have a look at the NSIS help manual, compile-time commands (chapter 5) |
|
|
|
|
|
#5 | |
|
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Quote:
!ifdef PROG_1 <include this and that> !endif !ifdef PROG_2 .............. !endif and in nsi file: !define PROG_1 Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: May 2006
Posts: 3
|
This goes back to my original solution of having multiple main files, that include common.nsi. And after trying this for several hours yesterday, I tried it again today, and it actually works now. I don't know what's different, but it is all good. Thanks for your help!
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|