Compile-time/Run-time defines
Hello,
I've read all related topics and documentation , but still
confused and dont know if it's possible to do what i need with NSIS installer.
I'm building setup packages for different affiliates.
Set of setup files is the same , but what changes is
packages name and installation folder.
Before running the setup , there is some small pre-setup
utility that can write values to registry.
The question is : is it possible "to tell" nsis to take
these values from registry and not to "hardcode" them in the script ?
Here's my current installation script:
---------------------------------
!define MUI_PRODUCT "AAASoft" ;Define your own software name here
!define MUI_PRODUCT_LINK "AAA Soft" ;Define your own software short cut here
!define MUI_VERSION "2.1" ;Define your own software version here
!define MUI_ICON "C:\SoftProjectV2\IconBig.ico"
!define MUI_UNICON "C:\SoftProjectV2\IconBig.ico"
SetCompress Off
!include "MUI.nsh"
;--------------------------------
;Configuration
AutoCloseWindow true ;
;General
OutFile "C:\SoftProjectV2\SoftSetup.exe"
;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
!define MUI_UNINSTALLER
;--------------------------------
;Language
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
BrandingText "Installing soft"
;--------------------------------
;Installer Sections
Section "CopyingFiles"
SetOutPath "$INSTDIR"
FILE "C:\SoftProjectV2\SoftDLLS\file1.dll"
FILE "C:\SoftProjectV2\SoftDLLS\file2.dll"
FILE "C:\SoftProjectV2\SoftDLLS\file.exe"
SectionEnd
;Add Shortcuts
Section "SettingEnvironment"
SetOutPath $INSTDIR
;Create Desktop Icon
CreateShortCut "$DESKTOP\${MUI_PRODUCT_LINK}.lnk" "$INSTDIR\soft.exe"
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT_LINK}.lnk" "$INSTDIR\soft.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT_LINK}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninst.exe"
WriteUninstaller "$INSTDIR\Uninst.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Delete Files
Delete "$INSTDIR\*.*"
;Delete Desktop Icon
Delete "$DESKTOP\${MUI_PRODUCT_LINK}.lnk"
;Delete Start Menu Shortcuts
Delete "$SMPROGRAMS\${MUI_PRODUCT_LINK}.lnk"
Delete "$INSTDIR\*.*"
RMDir /r "$INSTDIR\"
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_CURRENT_USER "SOFTWARE\${MUI_PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
SectionEnd
Function .onInstSuccess
ExecShell open "$INSTDIR\Soft.exe"
FunctionEnd
;eof
--------------------------------------------------------
What i need is small modification , so if there's some specific known location in registry defining product name - script will take it from there.
Thanks a lot!
P.S. I found out that "InstallDirRegKey" command might help,
is it correct direction ?