Archive: Nothing Too Complicated


Nothing Too Complicated
  I'm using NSIS v.2.0 b1 and am wanting to add multiple files for disty. Say a readme.html, and possibly even a .chm file.

How does one script that out?

np
:blah:


There are a few examples in your Examples directory (unless you chose not to install them). example1.nsi copies makensisw.exe to the user selected directory. Modern UI\Basic.nsi copies modern.exe to the user selected directory and makes the installer modern. Just replace the file names with your file names and if in need add more File commands to add more files.


Thanks. So I could just add on here:

SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe"
File "${NSISDIR}\Contrib\UIs\more.html
File "${NSISDIR}\Contrib\UIs\files.txt"
File "${NSISDIR}\Contrib\UIs\to_distribute.txt"

Would this be correct?


Almost. You don't have to put your files there. ${NSISDIR} maps to the path of your NSIS isntallation. You can use File C:\development\myfiles\more.html and even File test.html if the test.html is in the same directory as the script.


Ah yes. I need to the files to be in the same directory as my script to use it this way: (correct?)

File "modern.exe"
File "blah.ext"
File "whatever.txt"

And if I have/create a deployment directory, I just need to: (right?)

File "c:\my wonderful applications\laughing\grin.exe"
File "c:\my wonderful applications\laughing\sorry.im"
File "c:\my wonderful applications\laughing\pretty.tired"

..next question:

Where does this variable get defined -- so that I may make use of it:
SetOutPath "$INSTDIR"

Or am I misunderstanding its value.


Indeed. The path can also be relative. If for example you script is in C:\nsis and the files are in C:\NSIS\files then you can use:
File files\blah.txt. You can also use !cd to change the directory in which the compiler will look for files.

$INSTDIR is defined as follows:
If InstallDirRegKey is defined, and the value was found in the registry $INSTDIR will be initiated as this value. If it wasn't found, or wasn't defined InstallDir's value will be used. Later, after the directory selection page (if present) $INSTDIR will be set to whatever the user chose. You can change $INSTDIR anytime in between using StrCpy or any other command that accepts an output variable.

SetOutPath sets the path in which the installer will extract files. That means that if you use (and also creates it):


SetOutPath $INSTDIR

File blah
.txt
>
then blah.txt will be extracted to $INSTDIR.

10-4 !!

Awesome on the quick responses and thorough answers!

np