Archive: Another NSIS Self-Extractor


Another NSIS Self-Extractor
Hi! I'm new here.

Correct if I am wrong, but I'm going to break now Afrow UK's NSIS Self-Extractor monopoly. :)

So I made new NSIS Self-Extractor kit. It's based on sdbarker_tiny UI what I modified with Resource Hacker and I used Afrow UK's NSIS Self-Extractor as example (Afrow UK's define and macro system is mind blowing). This SE isn't even nearly exhaustive as Afrow UK's, but it does the job.

I probably should rename this SE kit to NSIS Self-Extractor lite or something to make a difference Afrow's SE kit, hmm maybe later.

I am not so great scripter/coder so if you know better way to do something or something is just wrong in my scripts please tell it to me.


So take a look.

http://koti.mbnet.fi/ckv/images/ckvse2.png

Supports also license page
Install (Extract) files page

Download


Nice and simple :)

If you could change the name, I'd be grateful in case people do not realise they are two different kits.

-Stu


New version
Update

Changes:


Some notes.
You cant use Open dir and replace prompt checkbox at the same time. If you use open dir function you cant use file replace prompt (will be fixed at next release).

Note:
Heres my macro for file replacing. This works, but now I have to use two parameters (directory and file) to get it work right. Is there any better way to do this?

Also I am using +offset in the in MessageBox function there are no mention in the NSIS documentation that this would work (seem to work with me :) ). Is it valid? If it is someone should add mention of it in the NSIS documents.


!insertmacro EXTRACT_FILE "" "license.txt"

!macro EXTRACT_FILE DIR FILE

!ifdef USE_REPLACE
StrCmp $checkb_val "0" 0 +5
IfFileExists "$OUTDIR\${FILE}" 0 +4
MessageBox MB_YESNOCANCEL "File...?" IDYES +3 IDCANCEL +5
DetailPrint "Skipped by user: ${FILE}"
Goto +2
File "${DIR}${FILE}"
Goto +2
Abort
!else
File "${DIR}${FILE}"
!endif

!macroend

Download ckv Self-Extractor + example
or load the attachment file

I've used two params in my version.

Relative jumps can be used on any flow-control instructions (including MessageBox).
However, relative jumps do not work for compile-time instructions (such as File). You need to use labels to jump over compile-time instructions properly.
If you use a relative jump (say Goto +2) before a compile-time instruction, you'll find that it jumps over everything including the next run-time instruction, which is usually not what one wants.

To use labels in macro's that are going to be included many times, see this page:
http://nsis.sourceforge.net/archive/...instances=0,44

-Stu


Thanks Stu. :)
But would this mean that even if you press no in the file overwrite prompt the file will be still overwritten? Or am i just confused? Because I am sure it don't overwrite files if you press no and it seems to work just like it should work.

I did little search with google on NSIS documents.
old NSIS document (2004): Relative Jumps
There was this note.
"Note: relative jumps don't work with Exch, File..."

Current NSIS document: Relative Jumps
That note is gone.

So maybe it's fixed. Maybe in 2.02
NSIS Changelog 2.02
"Made relative jumps work with instructions that add multiple entries"
:confused:


Ah yes, you're right there :)
I'm an old school NSIS so I often miss new things :(

-Stu


Re: New version
Update

Changes:

Screens:
Tiny UI is smaller than default UI (suprise)
Simple UI is even smaller

Download