add macro in MUI_PAGE_DIRECTORY
Hello,
it's my first time with nsis, and i have this installer and i'd like to add a macro for remove a directory when the user uninstall the software.
What should i do to add in Direcotry Page a checkbox to save this information?
How can i do to inform the uninstall that it has to delete the directory?
thx
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Thinware Remote Management"
!define PRODUCT_VERSION "beta1 (0.6-0)"
!define PRODUCT_PUBLISHER "Thinware s.r.l."
!define PRODUCT_WEB_SITE "http://www.thinware.it"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\trm.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
;
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE_3LINES
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "licenza.txt"
;
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\trm.exe"
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Thinware_Remote_Management__Manuale_Utente.pdf"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Italian"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Thinware Remote Management"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section "SezionePrincipale" SEC01
;
; general
;
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
CreateDirectory "$SMPROGRAMS\Thinware Remote Management"
CreateShortCut "$SMPROGRAMS\Thinware Remote Management\Thinware Remote Management.lnk" "$INSTDIR\trm.exe"
CreateShortCut "$SMPROGRAMS\Thinware Remote Management\Thinware Remote Management Manuale Utente.lnk" "$INSTDIR\Thinware_Remote_Management__Manuale_Utente.pdf"
CreateShortCut "$DESKTOP\Thinware Remote Management.lnk" "$INSTDIR\trm.exe"
File "..\bin_win32\trm.exe"
File "..\.obj\trm.intermediate.manifest"
File "..\docs\manuale_utente\Thinware_Remote_Management__Manuale_Utente.pdf"
;
; help
;
SetOutPath "$INSTDIR\help\en_us"
File /r "..\help\en_us\*.html"
SetOutPath "$INSTDIR\help\it"
File /r "..\help\it\*.html"
;
;translations
;
SetOutPath "$INSTDIR\translations"
File /r "..\translations\trm_*.qm"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Thinware Remote Management\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Thinware Remote Management\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\trm.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\trm.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) �stato completamente rimosso dal tuo computer."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Sei sicuro di voler completamente rimuovere $(^Name) e tutti i suoi componenti?" IDYES +2
Abort
FunctionEnd
Section Uninstall
;
; general
;
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Thinware_Remote_Management__Manuale_Utente.pdf"
Delete "$INSTDIR\trm.exe"
Delete "$INSTDIR\trm.intermediate.manifest"
;
; help
;
RMDir /r "$INSTDIR\help"
RMDir /r "$INSTDIR\translations"
Delete "$SMPROGRAMS\Thinware Remote Management\Uninstall.lnk"
Delete "$SMPROGRAMS\Thinware Remote Management\Website.lnk"
Delete "$SMPROGRAMS\Thinware Remote Management\Thinware Remote Management Manuale Utente.lnk"
Delete "$DESKTOP\Thinware Remote Management.lnk"
Delete "$SMPROGRAMS\Thinware Remote Management\Thinware Remote Management.lnk"
RMDir "$SMPROGRAMS\Thinware Remote Management"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd