Skip to content
⌘ NSIS Forum Archive

NSIS Self-Extractor kit

119 posts

Afrow UK#
Oops. I will check them out!

Edit: Fixed


-Stu
superrock2#
SE-ExecOnClose

Hi!

Thank you.

Sorry, but I found another problem.

If I am using ${SE-ExecOnClose} the Exec Program is not started. If I am disabling ${SE-ExecOnClose} it works properply.

Another comment. If I am setting also The readme option, the check box for the exec program is not available.
Afrow UK#
I was unable to reproduce your second problem. I can have both the readme and the Exec check-boxes in any order without a problem.

I have fixed the problem with ${SE-ExecOnClose}
I've also added ${SE-AutoClose} which makes the Self-Extractor automatically close itself when finished.

Download from same URL above.

-Stu
superrock2#
SE-ExecOnClose is ok

hi!

Thank you. Now it's ok.

Regarding second problem. It seems that only 2 check boxes can be active. So I can't add ${SE-OverwritePrompt}, when ${SE-Readme} and ${SE-OverwritePrompt} are inserted.
But that's really a problem.
Afrow UK#
I've added the new feature and I've changed a few of the setting names.

Use ${SE-ForceOverwritePrompt} (see Section 5 for more info).
See Section 4 for the new Check-Box setting names.
e.g. ${SE-Readme} is now ${SE-ReadmeCheckBox) and so on...]

(Same download link as before)

-Stu
Afrow UK#
New build available from same link (v0.18).

Fixed a bug if files contained spaces (macro label problem).

Added Dir-To-SE program which converts one or more directories into a NSIS Self-Extractor.

-Stu
deguix#
Maybe you could put the automatic detection of the NSIS folder on your example. I have NSIS in a totally different location than $PROGRAMFILES\NSIS.
RedBopete#
This is a very cool util - my first experience with an installer of any kind. I did have a few problems when installing a shortcut using a script created by the script generator (which is also very cool)...

This is what was generated and didn't work:
;- Shortcuts to create
${SE-ShortcutsStart}
${SE-Shortcut} "$DESKTOP\Glow Fish 2.lnk" "$INSTDIR\glowfish2.exe"
${SE-ShortcutsEnd}


I found that changing the middle line to include the middle (2nd) field *did* work:
;- Shortcuts to create
${SE-ShortcutsStart}
${SE-Shortcut} "$DESKTOP" "Glow Fish 2" "$INSTDIR\glowfish.exe"
${SE-ShortcutsEnd}

I also had to change "$DESKTOP\Glow Fish 2.lnk" to "$DESKTOP" since the first created an error when the script tried to install the icon at "$DESKTOP\Glow Fish 2.lnk\Glow Fish 2.lnk"

The icon on the desktop also was not the one that I specified using ${SE-Icon}, but was instead the icon that appears with the original .exe file (the one specified with "$INSTDIR\glowfish.exe"

any ideas on the whys, and what can be done?
Thanks!
Afrow UK#
I'll have a look tonight. It has been a while since I did anything to the ${SE-Shortcut} code. I'll add another field to the ${SE-Shortcut} command perhaps which specifies the icon path to use (or "" to specify default).

I may have used ${SE-Shortcut} simply to keep in with the ${SE-[Command]} syntax style, so you could try using CreateShortcut as a complete replacement. See http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4

-Stu
Afrow UK#
Uploaded SE v0.20
${SE-Shortcut} now takes the exact same syntax as NSIS's default CreateShortcut command.
Example.nsi now has some ${SE-Shortcut}'s in it.

-Stu
RedBopete#
Thanks, Stu :-)
The script compiles and executes properly now with the fields as they are generated using v0.20

My desktop is still not getting the icon that is specified with ${SE-Icon}, and is still getting the icon that appears with the original .exe file

Maybe this is how it's supposed to work? If so, maybe there's a workaround? I'm still new at this ;-)
Thanks for your time.
Afrow UK#
You'll have to store your .ico file in the Self-Extractor and extract it to $INSTDIR.
 ${SE-OutPath} "$INSTDIR"
${SE-File} "icon.ico"
Your shortcut would now be like this:
  ${SE-Shortcut} "$DESKTOP\shortcut.lnk" "$INSTDIR\file.exe" "" "$INSTDIR\icon.ico"
-Stu
TobWen#
Would it also be possible to REMOVE the temporary extraction folder after running the (forced) exe after extracting?

Perhaps there should be a routine, which checks, if the process is still running.

Would be a very nice feature.
Do you understand, what I mean?
Afrow UK#
To do something like that, you could put some custom code at the bottom of ${SE-FilesStart} (just before ${SE-FilesEnd})...

${SE-OutPath} "$INSTDIR\TempFolder"
${SE-File} "app.exe"
ExecWait "$INSTDIR\TempFolder\app.exe"
RMDir /r "$INSTDIR\TempFolder"

-Stu
Afrow UK#
Originally posted by TobWen
does this also work for "Zip-To-SE"?
I shall add some functionality to allow you to do this.

-Stu
Afrow UK#
Sorry for the long delay. I had to eat my dinner! 🙂

v0.21: Added 'Custom Functions' (see Section 8 in documentation)
Download from same link.

As for adding extra Self-Extractor code to Zip-To-SE and Dir-To-SE, you just need to put them into the header.nsh files (or you can specify your own header file from the application dialogues).

Edit: What you need to do is use
${SE-ExtractEndFunc} myFunc
then make a function:
Function myFunc
...Put ExecWait (etc) code in here
FunctionEnd

-Stu
Afrow UK#
Sorry, please download one more time. I just fixed a bug which has been there for some time that I just never noticed. The product name wasn't being displayed over the installation progress bar any more.

-Stu
RedBopete#
Woo hoo! I finally got it to work (downloaded the new copy, btw). It took me several tries, and wasn't sure exactly which folder the icon needed to go in, so put it in several - will sort through and determine which is correct, but for now the icon appears on my desktop correctly and it works. Nice job - thanks!!
Afrow UK#
I just uploaded a new build 0.21b.
Fixed a few bugs, and added some extra stuff.
Also cleaned up the readme quite a bit.

${SE-PageExtractPreFunc} is no longer called in .onInit (no good when you choose to have Password dialogue before Extract dialogue!)

Added ${SE-HeadingLine1} and ${SE-HeadingLine2}
These allow you to change both lines of the heading text. See documentation for more info (section 1)

Utilised the ${SE-FindExtractDir} code (faster now)

${SE-Product}, ${SE-HeadingLine1} and ${SE-HeadingLine2} now become their set value after use.

-Stu
Afrow UK#
Password text wasn't showing up (fixed).
Made changes to Password dialogue - added Confirm button and removed (disabled) Next button.

Made some minor changes to Directory dialogue.

-Stu
jonnebonne#
Thanks Afrow UK!
I like the self-extractor alot! Nice work!
But I have a question...
If I would like to add something more in the code (ex. MIDI play during installing), how can I attatch this?
I have tryed to write it in the SE and SE-Base...
I need to put some code in the .onInit section, and when I try to make a .onInit section, it returns: The .onInit sections is already there...

Maybe this is silly but can you help me a little? 🙂

Thanks! 🙂
Afrow UK#
Very sorry to keep you waiting for so many hours! I uploaded the new build a few hours ago, but have only just remembered to post the news!

I've added ${SE-onInitFunc} "function_name" in the latest build (v0.21d), along with ${SE-PagePasswordPreFunc} and ${SE-PagePasswordLeaveFunc} (for ${SE-Password} dialogue)

-Stu