I create an installer using NSIS and the code given below. The installer is created successfully created but when i install the program in pc uninstaller is not created during first insatllation but when i install it again, Uninstaller is created successfully> What can i do plz help...
My nsi script:
# declare name of installer file
!define PRODUCT_NAME "NepHotel"
Name "NepHotel"
outfile "NepHotel_setup.exe"
InstallDir $PROGRAMFILES\NepHotel
RequestExecutionLevel user
Page directory
Page instfiles
# open section
section ""
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" ""
;create start-menu items
CreateDirectory "$SMPROGRAMS\NepHotel"
CreateShortCut "$SMPROGRAMS\NepHotel\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "$INSTDIR\${PRODUCT_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\NepHotel\Readme.lnk" "$INSTDIR\user.props" "" "$INSTDIR\user.props" 0
CreateShortCut "$SMPROGRAMS\NepHotel\uninstall.lnk" "$INSTDIR\uninstall.exe" 1
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
"UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteUninstaller "$INSTDIR\Uninstall.exe"
SetOutPath $INSTDIR
File NepHotel.exe
File user.props
# end the section
sectionEnd
;Uninstaller Section
Section "Uninstall"
;Delete Files
RMDir /r "$INSTDIR\*.*"
;Remove the installation directory
RMDir "$INSTDIR"
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
RmDir "$SMPROGRAMS\${PRODUCT_NAME}"
;Delete Uninstaller And Unistall Registry Entries
enter code here DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall \${PRODUCT_NAME}"
SectionEnd
Function .onInstSuccess
MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. Use the desktop icon to start the program."
FunctionEnd
Put SetOutPath $INSTDIR before the call to WriteUninstaller.
You cannot use RequestExecutionLevel user and then install to $Programfiles/HKLM, you need to request administrator rights:
Outfile RequireAdmin.exe
; BEGIN 8< 8< 8< 8< 8< 8< 8< 8<
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
!include LogicLib.nsh
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
; END >8 >8 >8 >8 >8 >8 >8 >8
Page InstFiles
Section
SectionEnd
Related
while adding AccessControl NSIS fails with below error
Error: Can't change target architecture after data already got compressed or header already changed!
Error: Unable to set target charset (adequate stub not found?)
This is what i added in nsis, installed the plugin (pasted the dll in right folders), restarted the NSIS v3 app.
AccessControl::GrantOnFile "$INSTDIR" "(S-1-5-32-545)" "FullAccess"
Pop $0
;RequestExecutionLevel user
!include "MUI2.nsh"
!define MUI_INSERT_NSISCONF
BrandingText "Brand"
;!addplugindir "AccessControl\Unicode\Plugins"
!macro MUI_NSISCONF
!define MUI_BGCOLOR "SYSCLR:Window"
!define MUI_ICON "H:\Personal\learning\AI\App\app.ico"
!define MUI_UNICON "H:\Personal\learning\AI\App\app.ico"
!insertmacro MUI_PAGE_WELCOME
!macroend
Section "Install" SecDummy
SetOutPath "$INSTDIR"
;Store installation folder
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "DisplayName" "App"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "Publisher" "publisher"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "DisplayVersion" "2.1.4.0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "DisplayIcon" "$INSTDIR\app.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "NoModify" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "NoRepair" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "QuietUninstallString" "$INSTDIR\Uninstall.exe"
createShortCut "$STARTMENU\Programs\App.lnk" "$INSTDIR\App.exe" "" "$INSTDIR\app.ico"
;AccessControl::GrantOnFile "$INSTDIR\App.exe" "(BU)" "FullAccess"
;Pop $0
AccessControl::GrantOnFile "$INSTDIR" "(S-1-5-32-545)" "FullAccess"
Pop $0
;AccessControl::GrantOnRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "(BU)" "FullAccess"
;Pop $0
;AccessControl::GrantOnRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\App" "(S-1-5-32-545)" "FullAccess"
;Pop $0
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\*"
RMDir "$INSTDIR"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\App"
delete "$STARTMENU\Programs\App.lnk"
SectionEnd
Function .onInstSuccess
SetOutPath $INSTDIR
Exec '"App.exe"'
FunctionEnd
can someone please help to resolve the issue
I can't tell what the exact problem is because you have not posted enough code but I can guess:
You are trying to target something you don't have the required stub files for, for example if your .nsi has Target amd64-unicode.
You are trying to change the target too late in your script. Unicode and/or Target should be as early as possible in your .nsi, before !includes and functions/sections.
Try this to make sure a simple script works:
!verbose 4
Unicode True
!echo "NSIS ${NSIS_VERSION} (${NSIS_PACKEDVERSION}, CS=${NSIS_CHAR_SIZE}, ${NSIS_CPU})"
!echo "Choosing zlib-x86-unicode (${NSISDIR})"
SetCompressor /Final zlib
!if /FileExists "${NSISDIR}\Stubs\zlib-x86-unicode"
!echo "Stub exists, everything should be OK"
!else
!warning "Stub not there? Reinstall NSIS?"
!endif
!ifdef NSIS_WIN32_MAKENSIS
!echo "Compiling on Windows"
!endif
!ifdef NSIS_UNICODE_MAKENSIS
!echo "Using Unicode compiler"
!endif
Section
SectionEnd
It should output something like this:
MakeNSIS v3.08 - Copyright 1999-2021 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.
Processing config: C:\Program Files (x86)\NSIS\nsisconf.nsh
Processing script file: "C:\Test.nsi" (ACP)
Unicode: true
Processing default plugins: "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\*.dll"
NSIS v3.08 (0x03008000, CS=2, x86) (C:\Test.nsi:3)
Choosing zlib-x86-unicode (C:\Program Files (x86)\NSIS) (C:\Test.nsi:4)
SetCompressor: /FINAL zlib
Stub exists, everything should be OK (C:\Test.nsi:7)
Compiling on Windows (C:\Test.nsi:12)
Using Unicode compiler (C:\Test.nsi:13)
Section: ""
SectionEnd
Processed 1 file, writing output (x86-unicode):
Processing pages... Done!
Removing unused resources... Done!
Generating language tables... Done!
Output: "C:\Test.exe"
Install: 1 page (64 bytes), 1 section (1 required) (4144 bytes), 2 instructions (56 bytes), 23 strings (546 bytes), 1 language table (194 bytes).
Using zlib compression.
EXE header size: 38400 / 39936 bytes
Install code: 474 / 5396 bytes
Install data: 0 / 0 bytes
CRC (0x6FE2CBE1): 4 / 4 bytes
Total size: 38878 / 45336 bytes (85.7%)
My requirement is, I have specific files (Dlls, chms, etc) for each Locale (Language). I need to load those files based on the locale and generate the installer.
And while uninstalling i should uninstall those files as well from the traget directory.
Here what i am doing is in .onInit function, using GetUserDefaultUILanguage() i am getting the locale and checking this locale and loading the files under this locale.
is it the correct way? Please provide any suggestions for this code.
And also do we need to use ;Pages section before the ;Languages section?
Because i am getting a warning to use ;Pages section before the ;Languages section when i am compiling.
Below is the code snippet i have written:
; LocaleDlls.nsi
;
;
; It will install LocaleDlls.nsi into a directory that the user selects.
;--------------------------------
!include LogicLib.nsh
!include "MUI2.nsh"
; The name of the installer in the path C:\Program Files\LocaleDlls
Name "LocaleDlls"
; The file to write in the path E:\Source\NULLSOFT\src
OutFile "LocaleDlls.exe"
; The default installation directory in the path C:\Program Files\LocaleDlls
InstallDir $PROGRAMFILES\LocaleDlls
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically) It shows the path the path C:\Program Files\LocaleDlls
InstallDirRegKey HKLM "Software\NSIS_LocaleDlls" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;Pages
; Do we need to use PAGE macros before giving LANGUAGE as when compiling we are getting an error.
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" ; The first language is the default language
!insertmacro MUI_LANGUAGE "PortugueseBR"
;--------------------------------
;Installer Functions
Function .onInit
System::Call 'kernel32::GetUserDefaultUILanguage() i.r10'
MessageBox MB_OK "Return value = $R0"
StrCpy $Language ${LANG_PORTUGUESEBR}
MessageBox MB_OK "Return value = $Language"
${If} $Language P= 1046
MessageBox MB_OK "Current Locale is Portuguese... Loading Portuguese Files"
${EndIf}
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\AllowStandby.reg
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\Test.chm
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\Testdlg.dll
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\resource.dll
FunctionEnd
;--------------------------------
; The stuff to install
Section "LocaleDlls (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:\Program Files\LocaleDlls
SetOutPath $INSTDIR
; Give the File path
System::Call 'KERNEL32::AddDllDirectory(w "$INSTDIR")' ; Tell Windows we trust all .DLLs in this directory
System::Call 'KERNEL32::LoadLibrary(t "$INSTDIR\testdlg.dll.dll")p.r8 ?e'
Pop $7 ; Get ?e result
${IfThen} $8 P= 0 ${|} MessageBox MB_ICONSTOP "Failed to load pchuteres.dll, error $7" ${|}
${If} $8 P<> 0
MessageBox MB_OK 'Successfully loaded "$INSTDIR\testdlg.dll.dll" # $8'
${EndIf}
; Do the install
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_DllTesting "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "DisplayName" "NSIS LocaleDlls"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\LocaleDlls"
CreateShortcut "$SMPROGRAMS\LocaleDlls\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortcut "$SMPROGRAMS\LocaleDlls\LocaleDlls (MakeNSISW).lnk" "$INSTDIR\LocaleDlls.nsi" "" "$INSTDIR\LocaleDlls.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls"
DeleteRegKey HKLM SOFTWARE\NSIS_LocaleDlls
; Remove files and uninstaller
Delete $INSTDIR\LocaleDlls.nsi
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\LocaleDlls\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\LocaleDlls"
RMDir "$INSTDIR"
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
You don't need to call GetUserDefaultUILanguage, NSIS calls GetUserDefaultUILanguage to try to set the default $language. If it cannot find a matching language, the first language specified in the .NSI is used. All of this happens before .onInit is called and you don't have to do anything. You can however change $language in .onInit if you are not happy with the language NSIS has chosen. You can also use !insertmacro MUI_LANGDLL_DISPLAY to display a language selection dialog.
Pages need to be inserted before the language when using MUI because the language macro needs to know which strings are required by the pages. It is important that you use the MUI page macros MUI_PAGE_* and not the native page:
!insertmacro MUI_PAGE_WELCOME
Page Custom MyPage ; There is no MUI_PAGE_* macro for this
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English" ; Must come after all MUI_PAGE_* macros.
Total NSIS nube here. I had a script that was working, and now it isn't. It's based on an example provided on the nsis site:
# This installs two files, app.exe and logo.ico, creates a start menu shortcut, builds an uninstaller, and
# adds uninstall information to the registry for Add/Remove Programs
# To get started, put this script into a folder with the two files (app.exe, logo.ico, and license.rtf -
# You'll have to create these yourself) and run makensis on it
# If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
!define COMPANYNAME "F_YEAH"
!define DESCRIPTION "I'm stoked!"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
!define UPDATEURL "http://..." # "Product Updates" link
!define ABOUTURL "http://..." # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 7233
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "C:\Users\dkim\Documents\dog.ico"
outFile "GetSomeGA.exe"
!include LogicLib.nsh
# Just three pages - license agreement, install location, and installation
page license
page directory
Page instfiles
!macro VerifyUserIsAdmin
UserInfo::GetName
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
functionEnd
section "install"
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
File /r "C:\Users\dkim\Documents\Projects\MOR\Projects\GAintegration\GA_ConversionOnDemand_0.1"
File "C:\Users\dkim\Documents\dog.ico"
# Add any other files for the install directory (license files, app data, etc) here
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
# Start Menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$DESKTOP\pleaseClickMe.lnk" "$INSTDIR\GA_ConversionOnDemand\GA_ConversionOnDemand_run.bat" "" "$INSTDIR\dog.ico" 0
# Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} -
${APPNAME} - ${DESCRIPTION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR
\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$
\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR
\logo.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$
\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$
\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd
# Uninstaller
function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
# !insertmacro VerifyUserIsAdmin
functionEnd
section "uninstall"
# Remove Start Menu launcher
RMDir /r "$PROGRAMFILES\${COMPANYNAME}"
delete "$DESKTOP\click_or_die.lnk"
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
sectionEnd
The error message I get is:
!insertmacro: VerifyUserIsAdmin
Invalid command: UserInfo::GetName
Error in macro VerifyUserIsAdmin on macroline 1
Error in script "C:\Users\dkim\Documents\test3.nsi" on line 55 -- aborting creation process
It won't let me use any command involving UserInfo. Any ideas on what might be going on?
The compiler cannot find the UserInfo plugin or the plugin is corrupted.
The file should be in %ProgramFiles%\NSIS\Plugins in NSIS v2 and in %ProgramFiles%\NSIS\Plugins\x86-ansi or %ProgramFiles%\NSIS\Plugins\x86-unicode in NSIS v3 (depending on your target type).
This plugin is part of the default NSIS install so I would recommend that you just reinstall NSIS on top of your existing install...
I'm writing a NSIS installer for one of the apps that the company I work for uses internally, the install process works fine, with no problems all the REG keys are created, and so are the files folders and services, that the App uses. For some reason I can't understand, the uninstall process doesn't work's.
The services created by the app are deleted and so are the Registry keys, the most simple part, the files themselves, I can't delete them through the uninstaller!
#Includes
!include "x64.nsh"
#Defines and Installer Properties
Outfile "ESTvnc Installer.exe"
Name ESTvnc
Icon "${NSISDIR}\contrib\graphics\icons\VNCON.ico"
#Detect OS Version
Function .onInit
StrCpy $instdir $PROGRAMFILES
${If} ${RunningX64}
StrCpy $instdir $PROGRAMFILES32
${EndIf}
FunctionEnd
section
SetShellVarContext all
CreateDirectory $instdir\EST\ESTvnc
setOutPath $instdir\EST\ESTvnc
File /r installfiles\*
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc\" \
"DisplayName" "ESTvnc"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc"\
"UninstallString" "$instdir\EST\ESTvnc\uninstaller.exe"
writeUninstaller $instdir\EST\ESTvnc\uninstaller.exe
ExecWait '"$instdir\EST\estvnc\estvnc.exe" -install'
sectionEnd
section "Uninstall"
SetShellVarContext all
SimpleSC::StopService "ESTVNC" 1 30
pop $0
SimpleSC::StopService "ESTVNCSR" 1 30
pop $0
SimpleSC::RemoveService "ESTVNC"
SimpleSC::RemoveService "ESTVNCSR"
RMDir /r "$instdir\EST\ESTvnc"
Delete $instdir\EST\ESTvnc\uninstaller.exe
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc"
sectionEnd
In the uninstaller, $instdir is the directory the uninstaller is in!
Either place the uninstaller in $instdir and delete $instdir\EST\ESTvnc or if you want to keep it in $instdir\EST\ESTvnc, delete $instdir...
I'm using a pretty simple install script for my application and its showing an empty box on the section selection screen. I would like to remove it, or at least know what its for and fill it up.
here is a screenshot
and my install script
; example2.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install ICV-MRI into a directory that the user selects,
;--------------------------------
!include "MUI.nsh"
; The name of the installer
Name "ICV-MRI"
; The file to write
OutFile "ICV-MRI_Setup.exe"
; The default installation directory
InstallDir $PROGRAMFILES\ICV-MRI
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\ICV-MRI" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
Function LaunchLink
ExecShell "" "$INSTDIR\mri.exe"
FunctionEnd
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
; !insertmacro MUI_PAGE_WELCOME
; !insertmacro MUI_PAGE_DIRECTORY
; !insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Run MRI when the installer closes"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
Section "ICV-MRI (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "dist\bz2.pyd"
File "dist\library.zip"
File "dist\mri.exe"
File "dist\PyQt4.QtCore.pyd"
File "dist\PyQt4.QtGui.pyd"
File "dist\python26.dll"
File "dist\QtCore4.dll"
File "dist\QtGui4.dll"
File "dist\select.pyd"
File "dist\sip.pyd"
File "dist\unicodedata.pyd"
File "dist\w9xpopen.exe"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\ICV-MRI "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "DisplayName" "ICV-MRI"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\ICV-MRI"
CreateShortCut "$SMPROGRAMS\ICV-MRI\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\ICV-MRI\ICV-MRI.lnk" "$INSTDIR\mri.exe" "" "$INSTDIR\mri.exe" 0
SectionEnd
Section "Desktop Shortcuts"
CreateShortCut "$DESKTOP\ICV-MRI.lnk" "$INSTDIR\mri.exe" "" "$INSTDIR\mri.exe" 0
SectionEnd
;--------------------------------
If you want to remove it, !define MUI_COMPONENTSPAGE_NODESC at the top of your script
That box is for the section description.
Take a look at the Modern UI Basic.nsi file:
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Read more Modern UI Readme, section on Components page descriptions.
The Modern UI components page has a text box in which a description can be shown when the user hovers the mouse over a component. If you don't want to use these descriptions, insert the MUI_COMPONENTSPAGE_NODESC interface setting.
To set a description for a section, an additional parameter needs to be added to Section commmand with a unique identifier for the section. This name can later be used to set the description for this section.