Skip to content
⌘ NSIS Forum Archive

NSIS Self-Extractor kit

119 posts

Afrow UK#

NSIS Self-Extractor kit

Hello, it's me again!

After creating a lot of product installations for various games, mod's etc, I decided to write this kit for creating basic Self-Installers like that of WinZip and WinRAR (but more beautiful of course 🙂)

Screenshot:


[Download]
Archive page
Afrow UK#
I've just uploaded v0.02, which is at the same download location. The screenshot above is also of the new self-extractor.

-Stu
deguix#
I think the combination of Zip2Exe (and Tga2Exe), this UI design and your easy script manipulation (but I think need some improvements, as I'll say below), and the Context Menu shortcut would be excellent!

Just some things though:

1) I think the command names should be in Title Caps and w/o "_" (underscore) characters (like ${SE_FILE} -> ${SEFile}). This will make it more like the NSIS style command names (i.e. SetOutPath).

2) I didn't understand why put "=>" everytime you insert a File into the list of files to be extracted:
${SE_FILE} "local_path_to\file.ext" => "output_file"
As I said before, try to make it like the NSIS command names and parameters styles. It will make the script more compact and easier to produce by hand.

3) The extractor attributes are mostly in !define style, I suggest to change those into !insertmacro or even normal command styles. And change the position of the !include "SE.nsh" to the beggining of the script.

(Uhhuuuu! My Internet conection is flying at speed of light now!)
Afrow UK#
Thanks for the suggestions!

I am still working on adding other bits and bobs. I've allowed for the install details to pop-up over the top.

Now, I can't find a way to change the style of the first line in the listview. Is it possible? Again I don't have access to a list of defines, and the internet never shows anything that I want!

Edit: When I place the !include at the top of the script, the header doesn't see the defines below it (because it goes from the top of the nsi script and down, not the other way round). How does MUI fix this?
Edit#2: Ohh I see, it uses macro's not defines!

-Stu
Afrow UK#
I've done everything you suggested, and I must admit that it looks a lot cleaner now (the Example script that is!)

I just want to embolden the first line of the details window, where it says "Extraction details", because that is for the heading (I want it to stand out).
Is it possible?

-Stu
deguix#
!define WM_SETFONT                      0x0030
CreateFont $0 "$(^Font)" "$(^FontSize)" "700"
SendMessage $hCtrl ${WM_SETFONT} $0 0 
bholliger#
Cool thing!

This is a great addon! Thanks!

One suggestion: It would be nice if there's another checkbox "Open Folder after Compression" or something like that on the extract-dialog.

Have a nice day.

-Bruno.
Afrow UK#
Originally posted by deguix
!define WM_SETFONT                      0x0030
CreateFont $0 "$(^Font)" "$(^FontSize)" "700"
SendMessage $hCtrl ${WM_SETFONT} $0 0 
I'm aware of that code, but I don't know how to get the hCtrl of the first line of the details view.

-Stu
deguix#
first line of the details view
Is this a Label or a ListBox? If it's a ListBox, you can't put a line with different font from the else. It's ListBox rule.
Afrow UK#
Uploaded a new (perhaps final) build.

This one includes all the new code, and the "When done, open extraction directory" check-box which replaces the readme check-box if specified. Note that you cannot have both the readme check-box and opendir check-box (that would be anoying for the user if both opened at the same time!)

Download from same URL's above.

-Stu
deguix#
Uploaded a new (perhaps final) build.
Oh oh, I've done small tests and I found some more room for improvement:

Script:

1) Major Bug:
This one includes ... the "When done, open extraction directory" check-box which replaces the readme check-box if specified
Strange. I don't see it.

2) Minor Bug:
unknown variable/constant "SE_OVERWRITE_STATE" detected, ignoring (macro:SE_FILE:1)
When I use the command ${SE-NoOverwrite}.

3) Minor bug: When I set ${SE-Font} to a font, it doesn't set the font before the installation to Extract Progress: label control (see on the left of progress bar), but when I start the installation it changes to the correct font.

4) Suggestion: Default of ${SE-Product} should be set to the executable file name without its extention.

5) Suggestion: Default of ${SE-OutFile} should be set to the script file name changing only the extention.

6) Minor Suggestion: In the example script, try to use indentation on the code between ${SE-FilesStart} and ${SE-FilesEnd}.

Readme:

General: You should make some corrections for the changes you've done:

- ${SE-NoOverwritePrompt} is wrong, the correct is ${SE-NoOverwrite}.
- ${SE-File} parameters are from a previous version.
- If undefined term used for all the old version defines that were changed into commands on this version, change to If not used.
- {SE-NoOpenDir} doesn't exist (because of a checkbox that doesn't exist either).
- And some others that I don't have patience to look for (at this time in the morning - 4:00 AM - what are you expecting me to do?).

General:

1) Major Suggestion: An option to create a Start Menu shortcut folder for the files to be extracted.
Afrow UK#
Okies fixed a lot of the stuff. The reason that you don't have an open-dir check-box is because you cannot have that and a readme check-box. Comment out the readme code and the open-dir check-box will appear. Use ${SE-NoOpenDir} to hide that check-box as well.

Added new code for shortcuts. No new check-box though, just an optional message box w/ Yes/No.

How would one get the executable/script file names w/o file extensions on compile time? Remember the Name and Caption are set on compile time.

-Stu
deguix#
The reason that you don't have an open-dir check-box is because you cannot have that and a readme check-box.
Are you sure it's working correctly on version 0.3? Did you try to comment ${SE-Readme} line in your example script?

How would one get the executable/script file names w/o file extensions on compile time? Remember the Name and Caption are set on compile time.
Hmmm... just ignore that.
Afrow UK#
Mmm, it worked here... maybe it didn't get into the extractor that I uploaded (don't know why).

I will upload 0.04 now...

-Stu
Afrow UK#
Uploaded new version.

Added setting for install window and extraction progress font. Default is Verdana (because it is smaller than Ms Shell Dlg at 7pt allowing 2 lines to fit in the extraction progress label)

-Stu
deguix#
Oh oh, again:

Script:

1) Minor Bug: ${SE-ExtractListFont} doesn't support multiword font names, like "Times New Roman".

2) Minor Bug: ${SE-NoShortcutsMessage} doesn't hide the MessageBox as it should do.

3) Persistant Bug:
unknown variable/constant "SE_OVERWRITE_STATE" detected, ignoring (macro:SE_FILE:1)
When I use the command ${SE-NoOverwritePrompt}.
Afrow UK#
Thanks for searching for the bugs! I should be more thorough myself, but this is just one of my spair time projects (I'm currently working on a map database website for a Half-Life mod.)

They should all be fixed now.
The first bug was because I didn't use quotes around the define value.
The second and third bugs were from using !ifdef and !ifndef outside the macro's.

Uploaded again (still v0.04).

Edit: Just fixed the small bug where the SE-ExtractListFont wouldn't be set for the extraction details label.

-Stu
Afrow UK#
New version uploaded (definately final) which comes with a DHTML Step-by-step Script Generator plus a few additions to the Self-Extractor itself (About button).

Uploaded to same URL (v0.05)

-Stu
Joost Verburg#
Using MS Shell Dlg the font is automatically set to the system shell font. I think this should be the default font.

When I look at the screenshots the user interface looks a bit "compressed", remember that having a smaller window is not always better. Usually some space between controls makes it more user friendly.
deguix#
The version number does say that it is a beta and not completed version. So changes are not over yet (however you can see that the list of bugs is much smaller than the older lists):

1) Bug: The readme page is not creating another Internet Explorer window but instead it uses an already existant window. Use an empty string instead of open to use the really default action which is opennew for me.

2) Script Typo: You doubled the same line ${SE-OutFile} "NSIS Self-Extractor.exe" in the example script.

3) Minor Bug: When you use a font name with ${SE-ExtractListFont} it appears that the font size becomes smaller. Make sure it looks like the same when not using the command and when using the command w/ "Verdana" (if you can).
deguix#
Oh, I didn't see that before (I only saw it when I opened the Documentation folder, that means I was looking on an older Readme version).

It's marvelously excellent! I should borrow some of your codes in Javascript and ActiveX. You've done a lot of work to get there. Very good job, man. But just one thing though, why did you put Skip This Step button enabled on Step 3? You can't skip that part because it's essential!
Afrow UK#
That's a good point. If you do skip it at the moment, the finish button is disabled (if you do not include a readme as well.)

I just thought though... I should include the readme with the SE-File macro so that the overwrite prompt (if enabled) shows up.

-Stu
Afrow UK#
Ok, uploaded new build.
Added a new SE-ForceExec to execute a file once the extraction process has finished. This will be useful for zip's that have been placed in the self-extractor.

-Stu
Afrow UK#
Argh, a new build!

Added a setting to store the extraction dir in the registry.
Added settings for searching for a readily existing directory to extract files to.

Fixed a number of bugs, plus added 'Save to File' in the script generator (ActiveX)

-Stu
dRaakje#
Hi, nice work, but, as you can see in the screenshot, on XP with the classical theme the description text is displayed on two lines, causing the bottomhalf to fall off.

Perhaps you should force a specific, smaller font for that text? Hmmm, I don't suppose it's easy to have the path changed into using dots in the middle of the string to compact it when it's too long. (like "D:\...\installdir")

Remco

VegetaSan#
omg. Afrow UK very nice job bro. my compliments 😁

and that dhtml script maker stuff. ...... really great .. 😉

NICE!!! 😁
Afrow UK#
Originally posted by dRaakje
Hi, nice work, but, as you can see in the screenshot, on XP with the classical theme the description text is displayed on two lines, causing the bottomhalf to fall off.

Perhaps you should force a specific, smaller font for that text? Hmmm, I don't suppose it's easy to have the path changed into using dots in the middle of the string to compact it when it's too long. (like "D:\...\installdir")

Remco

[Image]
I think I will have to make the dialogue larger.
It's just a bit cramped at the moment!

-Stu