Archive: NSIS Self-Extractor kit


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:
http://myweb.tiscali.co.uk/imker/dow...-extractor.png

[Download]
Archive page


Nice :)

Cool ;)


I've just uploaded v0.02, which is at the same download location. The screenshot above is also of the new self-extractor.

-Stu


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!)

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


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



define WM_SETFONT                      0x0030


CreateFont$0 "$(^Font)" "$(^FontSize)" "700"
>SendMessage $hCtrl ${WM_SETFONT} $0 0
>

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.


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

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.

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


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.

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


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.

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


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


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}.

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


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


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.


Uploaded 0.06 (definately final)
Fixed a few errors in the NSH and script-gen JS

-Stu


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).


Thanks for that, really :D
Fixed em' all. Btw, what do you htink of the script-gen?

-Stu


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!


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


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


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


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

http://www.xs4all.nl/~ralam/nsis_self-extractor.jpg


omg. Afrow UK very nice job bro. my compliments :D

and that dhtml script maker stuff. ...... really great .. ;)

NICE!!! :D


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

Ok, uploaded a new build. Try and see if it's ok now..

-Stu


Still the same. I've updated my screenshot, look for your self... You can't force a smaller font? Or compact the folder string with dots in the middle?

Still, this is nitpicking, it looks great!

:)


Hmmf. It's because I made the kit on Windows XP... the font used there is Verdana size 7. On Windows XP, it's much much smaller (if you look at my screenshot) but for some reason it is larger for you.

I will see what I can do. And don't worry it's not nit-picking. User input is exactly what I like to see!

-Stu


Actually, I'm using Xp also, but the first thing I do after I install Xp is turn of that f***ing teletubby theme and go back to classic windows.

<RANT>That XP theme has larger controls, meaning less space left for the really important stuff (such as the source windows when I'm programming)</RANT>

So, if you want to test yourself, go to your desktop properties and change from windows xp theme to windows classic theme, then you can see for your self (Might be a good idea to save your current theme first, so you can restore it later on)

Oh, and since it's Windows Classic, it'll probably be using MS Sans Serif, 8 pts for the text. That's what windows usually uses everywhere else. ;)

Remco


I actually found an error in my code which was causing the extraction text label font to be bigger on the instfiles page than the directory page.

I've fixed it. The font is now Verdana size 7 again for that label.

I've also added some new stuff under the "Extended settings" category (in readme and script generator).

-Stu


I've added some more features (mainly for registry support). I also fixed a few bugs in the Script-Generator.

I may write a small NSIS-based program to convert Zip's to NSIS Self-Extractor's too, as I'm opening a Half-Life mod map database soon, and I will be using my Self-Extractor as an extra download option for maps.

-Stu


I may write a small NSIS-based program to convert Zip's to NSIS Self-Extractor's too
Are you going to use the ZipDLL plugin, or another program in combination with yours?

I'm opening a Half-Life mod map database soon
How many databases and programs do you have for games?

I only have 1 program with a database and both are being redone from scratch now. But this program is not just a updater for the game, it makes several changes in game interface, besides of making easier for the user to select game patchs.

I'm not going to use ZipDLL, because last time I tried using it for my 'D-Day Zip Extractor' about 10% of the Zip's wouldn't extract. They weren't corrupt either (as WinZip and Windows Explorer could open them.)

I'm using 7-zip's command-line program, but it's a bit on the large side (500kb!)... so does anybody know of a small Zip decompressor program (which only does Zip.)
I've got pkunzip, but it only allows for short file names/paths which really won't do (program was written over 10 years ago!)

Cheers

-Stu


The unziper from the info-zip distro ist only 160 kb.

You can find it here as a whole package. http://sunsite.cnlab-switch.ch/ftp/m...2/unz551xN.exe

And i guess it's capable of LFN


Thanks. I will try it out (W00T only 160kb!)

-Stu