Skip to content
⌘ NSIS Forum Archive

$(^NameDA) not found for uninstaller.

6 posts

touchring#

$(^NameDA) not found for uninstaller.

Hi, i'm a newbie, recently, i took over an NSIS project done by another programmer. The project uses MUI.

For 2 days, I've been trying in vain to find out how to solve a bug in which the "program name" does not appear in the uninstaller. The problem does not affect the installer and the software appears ok in Windows Add/Remove dialog as well.

My investigations led me to the variable $(^NameDA) in the file English.nlf.

For example, the line

"$(^NameDA) will be uninstalled from the following folder."

will appear as

" will be uninstalled from the following folder." in my uninstaller.

Here's some code, hope someone can give me a tip on where to look. Would appreciate a lot. 🙂

#####################
# Uninstaller pages #
#####################

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
########################
# Installer attributes #
########################

Name "$_ShortName"
OutFile "installer\bin\${DEFAULT_SETUP_FILENAME}" ; Installer output file
InstallDir "$PROGRAMFILES\$_CombinedVar" ; Default installation directory
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
BrandingText "$_CompanyName" ; Text at the bottom of the install window
ShowInstDetails hide ; Details are not shown by default
ShowUnInstDetails hide ; Details are not shown by default
XPStyle on ; XP controls styles
CRCCheck on ; The installer performs a CRC check before installing
;SetCompressor lzma

VIProductVersion "0.0.0.0"
VIAddVersionKey ProductName ""
VIAddVersionKey ProductVersion ""
VIAddVersionKey CompanyName ""
VIAddVersionKey CompanyWebsite ""
VIAddVersionKey FileVersion ""
VIAddVersionKey FileDescription ""
VIAddVersionKey LegalCopyright "?2006. All rights reserved."

###########################################################################################
# Copy the installer to the installation directory for the Repair/Modify uninstall option #
###########################################################################################

CopyFiles /SILENT "$EXEDIR\${DEFAULT_SETUP_FILENAME}" "$INSTDIR\${DEFAULT_SETUP_FILENAME}"
]

Section -post SEC0001

WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\VisualGSMManager.exe"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "$_LongName"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "ModifyPath" '"$INSTDIR\${DEFAULT_SETUP_FILENAME}" /repair'
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "RepairPath" '"$INSTDIR\${DEFAULT_SETUP_FILENAME}" /repair'
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\VisualGSMManager.exe"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayVersion" "0.0.0.0"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLInfoAbout" ""
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "Publisher" "$_CompanyName"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" ""
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLInfoAbout" ""
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "VersionMajor" "1"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "VersionMinor" "0"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "HelpLink" ""
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "NoRepair" "0"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "NoModify" "0"

SectionEnd
#########################
# Uninstaller functions #
#########################

Function un.onInit

!insertmacro MUI_UNGETLANGUAGE
SetAutoClose true

FunctionEnd
Anders#
you are using a variable in name, you must init $_ShortName in un.onInit (or just don't use a variable)
touchring#
Originally posted by Anders
you are using a variable in name, you must init $_ShortName in un.onInit (or just don't use a variable)

Thanks, i got an error "Invalid command: init". I apologize if this is a silly question.
touchring#
Originally posted by Anders
you must use StrCpy $_ShortName "something" in un.onInit

Thanks, you're great, i guess it is necessary to initialize $_shortname in uninstall even though it has already been done over in install code.