INSTALLER advice - Ciro's tips on NSIS scripting.

Post anything that doesn't belong in any other forum, including gaming and topics unrelated to motorsport. Site specific discussions should go in the site feedback forum.
modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

INSTALLER advice - Ciro's tips on NSIS scripting.

Post

Hi. I need a freeware installation wizard with maximum available compression rate. Can you advise on this? I've never had experience with these.
Last edited by modbaraban on 05 Sep 2007, 11:16, edited 1 time in total.

Carlos
Carlos
11
Joined: 02 Sep 2006, 19:43
Location: Canada

Post


User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

You could use NSIS. You have to study it for a couple of days to learn its scripting language. Read the introduction, skip the initial lessons and go directly for MUI (Modern User Interface) instructions.

It has zlib, bzip2, and LZMA compression and you can choose how much compression you want on the Install.exe file you produce.

If you have any questions (not too difficult, please, :) I'm a newbie with it) send me a PM.
Last edited by Ciro Pabón on 05 Sep 2007, 09:54, edited 1 time in total.
Ciro

modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

Post

@ Carlos
No. I mean the software that is used to pack-up and compress files into SETUP.exe file. The one we use to install software. Maybe something like ZIP self extracting archive but with better compression rate and interface.
Last edited by modbaraban on 05 Sep 2007, 10:06, edited 4 times in total.

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

We posted at the same time. I repost so you notice on the forum home page.

EDIT: allright, you are reading now. :) Maybe you'll read this, I won't post again.

If you choose NSIS then you could download HM NIS Edit (mentioned in the article) to help you with writing the scripts (it checks your syntax).

Start with the samples provided with NSIS.

1. Install NSIS.
2. Click File/Load Script and pick one of the files in C:\Program Files\NSIS\Examples\Modern UI.
3. Click "Test Installer"
4. Open the script you created with Notepad (or NIS Edit) and read it. If you choose (for example) the script with the name "Basic.nsi" in step 2, then you have created an installer named "Basic.exe".
5. Click File/Help/NSIS User Manual to read it

The idea is that you use the compiler to "run" the scripts you write. Then NSIS compresses the files you specify in the script and creates your SETUP.exe.

You can create an uninstaller.exe and include a page to choose components (if your program has several versions, for example installation for users and installation for server).

Using NSIS, you can write your installation directory and other parameters to Windows registry with relative ease, so you can throw away your program's config file, if you use one.

In that case, if you're using VB for example, you can use the VB instructions "GetSetting" and "SaveSetting" to get and put information in the registry, instead of reading parameters from a config file.
Last edited by Ciro Pabón on 05 Sep 2007, 10:29, edited 2 times in total.
Ciro

modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

Post

Ciro Pabón wrote:We posted at the same time. I repost so you notice on the forum home page.
Thnx. I noticed and was already in process of reading that wiki. :)

Reading that I realized that I know too little about it :o Tomorrow I'll need to upload something that weighs about 1GB (uncompressed).

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

Then open the "Basic.nsi" script in the Examples\MUI directory, open it with Notepad and modify it like this:

Change this lines:

1. OutFile "Basic.exe"

Change Basic.exe for Setup.exe (or whatever is the name of the installer exe file you wish to build):

2. InstallDir "$PROGRAMFILES\Modern UI Test"

Change "Modern UI Test" for the name of your default installation directory (for example "Modbaraban Software"). It will install your program in C:\Program Files\Modbaraban Software by default (if the user doesn't choose a different directory).

3. !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"

Change "\Docs\Modern UI\License.txt" to the path and file with the text of your license ("Modbaraban software hereby declares you can use this program if you bent backwards..." or whatever).

4. !insertmacro MUI_LANGUAGE "English"

Change to the language you wish, for example, "Ukrainian"... ;)

5. SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...


Erase ";ADD YOUR OWN FILES HERE..." and replace it for "File" and the names of the files you want to compress. You can use several SetOutPaths, if you have your files in subdirectories. For example:

SetOutPath "$INSTDIR"
File "Simulator.exe"
File "Database.mdb"

SetOutPath "$INSTDIR\Help"
File "Help.chm"


This will install the files Simulator.exe and Database.mdb in "C:\Program Files\Modbaraban Software" (or the directory chosen by user) and Help.chm in "C:\Program Files\Modbaraban Software\Help".

6. Section "Uninstall"

;ADD YOUR OWN FILES HERE...


Erase ";ADD YOUR OWN FILES HERE..." and replace it for "Delete" and the name of the files you installed and RMDir and the names of the directories you created. Following my example, I should write the instruction:

Delete "$INSTDIR\*.*"
Delete "$INSTDIR\Help\*.*"

RMDir "$INSTDIR\Help"
RMDir "$INSTDIR"


This will create an uninstaller that will erase the files and directories I created before in step 5.

7. Open NSIS and click "File\Load Script" and choose Basic.nsi.

That's it.
Last edited by Ciro Pabón on 05 Sep 2007, 11:17, edited 1 time in total.
Ciro

modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

Post

Thanx Ciro, that looks great! Check the topic name :lol:

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

You're an evil ukrainian! :lol:

Tell us if it worked.
Ciro

User avatar
m3_lover
0
Joined: 26 Jan 2006, 07:29
Location: St.Catharines, Ontario, Canada

Post

Ciro Pabón wrote:You're an evil ukrainian! :lol:

Tell us if it worked.
Aren't they all Evil? lol
Simon: Nils? You can close in now. Nils?
John McClane: [on the guard's phone] Attention! Attention! Nils is dead! I repeat, Nils is dead, ----head. So's his pal, and those four guys from the East German All-Stars, your boys at the bank? They're gonna be a little late.
Simon: [on the phone] John... in the back of the truck you're driving, there's $13 billon dollars worth in gold bullion. I wonder would a deal be out of the question?
John McClane: [on the phone] Yeah, I got a deal for you. Come out from that rock you're hiding under, and I'll drive this truck up your ass.

modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

Post

m3_lover wrote:Aren't they all Evil? lol
Perhaps, only those who moved to Canada :lol:

Image

User avatar
joseff
11
Joined: 24 Sep 2002, 11:53

Post

Sorry for going OT in a NSIS thread, but answering the original question:

I'm more of an Innosetup person.
http://www.jrsoftware.org/isinfo.php

Methinks it's easier to use, with the same LZMA compression that NSIS uses.

segedunum
segedunum
0
Joined: 03 Apr 2007, 13:49

Post

Innosetup:

http://www.jrsoftware.org/isinfo.php

It's a bit easier to use than NSIS.

EDIT: Someone beat me to it. Didn't read the last comment.

The tools are pretty good for Innosetup, good compression and an awful lot of options to do anything you want.

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

Thanks, joseff, segedunum.

There is also Wix, from Microsoft. It's Open Source. I haven't tried it, you have to build an XML document to "guide" the creation of the installation package.

http://wix.sourceforge.net/
Ciro

modbaraban
modbaraban
0
Joined: 05 Apr 2007, 17:44
Location: Kyiv, Ukraine

Post

Thankfully I found a programmer buddy to do this for me while I do other stuff. :D