Archive: WriteEnvStr issue


WriteEnvStr issue
Hello, I would like to add a System Variable during installation using NSIS. Now, I copied the Function WriteEnvStr.nsh and put it in my NSIS/Include folder.

Basically my script looks like this:

; example1.nsi
;
; This script is perhaps one of the simplest NSIs you can make. All of the
; optional settings are left to their default settings. The installer simply
; prompts the user asking them where to install, and drops a copy of "MyProg.exe"
; there.

;--------------------------------

!include WriteEnvStr.nsh

; The name of the installer
Name "Self Service"

; The file to write
OutFile "selfservice.exe"

; The default installation directory
InstallDir $PROGRAMFILES\SelfService

; The text to prompt the user to enter a directory
DirText "This will install Self Service on your computer. Choose a directory"

;--------------------------------


; The stuff to install
Section "Install" ;No components page, name is not important




; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File MozEmbed.exe


SetOutPath $INSTDIR\others

File "C:\Documents and Settings\igwe\Desktop\ed2k-fasttrack-0.10\skops\*"


WriteUninstaller $INSTDIR\Uninstall.exe


SectionEnd ; end the section

; The uninstall section
Section "Uninstall"

Delete $INSTDIR\Uninstall.exe
Delete $INSTDIR\MozEmbed.exe
Delete $INSTDIR\others\*
RMDir $INSTDIR

SectionEnd


But I keep getting errors with this. The compiler gives the following message:

Processed 1 file, writing output:
Error: resolving install function "WriteEnvStr" in install section "Add Env Var" (0)
Note: uninstall functions must begin with "un.", and install functions must not
Error - aborting creation process

I am using the latest NSIS 2. Any ideas on how to fix this issue?


Looks like an error in the header (WriteEnvStr.nsh) script.

-Stu


Ok I think it's because WriteEnvStr.nsh also contains an Uninstall section (you can't have two with that name).

Edit: Which part of the page did you save to WriteEnvStr.nsh?
It's the bottom bit you want on http://nsis.sourceforge.net/archive/...php?pageid=137 under "The functions"

-Stu