priyankaB
13th April 2012 09:50 UTC
Stop the background installation after uninstalling option selected using nsDialog
Hi All,
I am into the initial phase of learning the NSIS scripting.
I would like to know how can I stop the installation, when the user selects uninstall option (on the custom page with options reinstall or uninstall). I do not want the user to install the application after uninstalling. It should simply quit. Code snippet of my Custom Leave function is as below:-
---clip---
Function LeaveCustomCheck
Pop $hwnd
${If} $hwnd == $Group1Radio1
;Perform Installation
${ElseIf} $hwnd == $Group1Radio2
SetAutoClose true
BringToFront
ReadRegStr $R1 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
HideWindow
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
IfErrors no_remove_uninstaller
IfFileExists "$INSTDIR\uninstall.exe" 0 no_remove_uninstaller
Delete "$R1"
RMDir $INSTDIR
Quit
;Call RelGotoPage
no_remove_uninstaller:
${Else}
MessageBox MB_ICONSTOP "Please select either of the options or press Cancel to exit installer." IDOK
Abort
${EndIf}
FunctionEnd
---clap---
Once the user selects "Uninstall" radiobutton and presses "Next" button, the uninstallation starts and hides the page behind it. After the uninstallation ends, the page MUI_PAGE_DIRECTORY pops up, to select directory for further installation. I want this script to end once Uninstallation completes.
Would appreciate, if anyone of you can help me with a solution for the same.
Thanks in advance.
-Priyanka
MSG
13th April 2012 10:29 UTC
You should never install or uninstall anything in a page's leave function - that way you're making changes to the users system before the actual instfiles page comes up!
What you should do is set a variable to install, uninstall or reinstall/modify. Then do:
section YourSection
${If} $Variable == install
;install
${Else}
;uninstall
${EndIf}
sectionend
You could also modify the finish page in its show function, depending on the value of the variable.
priyankaB
13th April 2012 16:13 UTC
I am still confused, if the above specified solution will work. Here is what I am trying to achieve in my script:-
1. If the application is not installed, then simply install the same without showing Custom Page.
2. If the application is already installed, then show the custom page (with options reinstall/uninstall) and perform action as selected by the user.
Also, both the install and uninstall sections are different. So, would it be possible to do installation and uninstallation within one section?
Here is my script:-
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "MITRAC CC TDS-PROG Tool"
!define PRODUCT_VERSION "2.6.0.6"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\TDSProg.exe "
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define TEXT_IO_TITLE "MITRAC CC TDS-PROG Tool"
!define TEXT_IO_SUBTITLE "This Application is already installed. What would you like to do?"
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "nsDialogs.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!define MUI_ICON "TDSProjectToolInstall.ico"
!define MUI_UNICON "TDSProjectToolUninstall.ico"
; 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"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; Welcome page
!insertmacro MUI_PAGE_WELCOME
/*; License page
!insertmacro MUI_PAGE_LICENSE "..\SoftwareLicence.txt"*/
;Overwrite Check
Page custom ShowCustomCheck LeaveCustomCheck
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\TDSProg.exe "
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "MITRAC_CC_TDS-PROG-Tool_2.6.0.6_install.exe"
InstallDir "$PROGRAMFILES\MITRAC\TDS-PROG2"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
var dialog
var hwnd
var Group1Radio1
var Group1Radio2
var Label
var Text
Function ShowCustomCheck
ReadRegStr $R0 HKLM "${PRODUCT_UNINST_KEY}" "DisplayName"
StrCmp $R0 "" lbl_ok 0
nsDialogs::Create 1018
Pop $dialog
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
${NSD_CreateLabel} 0 0 100% 20% "$(^Name)is already installed. Select the operation you want to perform and click Next to continue."
Pop $Label
${NSD_CreateRadioButton} 10 30 60% 25% "Re-install"
Pop $Group1Radio1
${NSD_AddStyle} $Group1Radio1 ${WS_GROUP}
${NSD_OnClick} $Group1Radio1 RadioClick
${NSD_CreateRadioButton} 10 35% 25% 12% "Un-install"
Pop $Group1Radio2
${NSD_OnClick} $Group1Radio2 RadioClick
nsDialogs::Show
lbl_ok:
Return
FunctionEnd
Function RadioClick
;
FunctionEnd
Function LeaveCustomCheck
Pop $hwnd
${If} $hwnd == $Group1Radio1
;Perform Installation
${ElseIf} $hwnd == $Group1Radio2
SetAutoClose true
BringToFront
ReadRegStr $R1 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
;HideWindow
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
IfErrors no_remove_uninstaller
IfFileExists "$INSTDIR\uninstall.exe" 0 no_remove_uninstaller
Delete "$R1"
RMDir $INSTDIR
Quit
;Call RelGotoPage
no_remove_uninstaller:
${Else}
MessageBox MB_ICONSTOP "Please select either of the options or press Cancel to exit installer." IDOK
Abort
${EndIf}
FunctionEnd
Section "MainSection" SEC01
lbl_inst:
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "..\TDSProg\release\TDSProg.exe"
CreateDirectory "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG"
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS-PROG Tool.lnk" "$INSTDIR\TDSProg.exe"
CreateShortCut "$DESKTOP\TDS-PROG Tool.lnk" "$INSTDIR\TDSProg.exe"
File "..\TDSProg\release\MTScc.dll"
File "..\TDSProg\release\MTHelpViewer.dll"
File "..\TDSProg\release\MTResManager.dll"
File "..\TDSProg\release\MTGrid.dll"
File "..\TDSProg\release\TDSLib.dll"
File "..\TDSProg\release\TDSOutput.dll"
File "..\TDSProg\release\TDSParseDLL.dll"
File "..\TDSProg\release\TDSParseDLL_Unicode.dll"
File "..\TDSProg\release\Trace.dll"
File "..\TDSProg\release\TDSImportInterface.dll"
File "..\TDSProg\release\TDSXMLExportPlugin.dll"
File "..\TDSProg\release\olexlsf.tlh"
File "..\TDSProg\release\olexlsf.tli"
File "..\service\makedlu\makedlu.exe"
File "..\service\makedlu\tar.exe"
File "..\service\makedlu\gzip.exe"
File "..\service\makedlu\zip.exe"
File "..\service\xfo40-reg-20090111\REG\Lib\olexlsf.dll"
Exec "Setenv D:\Program Files\MITRAC\TDS-PROG2"
Exec "REGSVR32.EXE olexlsf.dll"
SetOutPath "$INSTDIR\temp"
File "..\TDSProg\release\temp\exportFile.xls"
SectionEnd
SetPluginUnload alwaysoff
Section "SupportDll" SEC02
SetOutPath "$INSTDIR"
File "mfc42loc.dll"
File "QtCore4.dll"
File "QtGui4.dll"
File "QtXml4.dll"
SectionEnd
Section "Help" SEC03
SetOutPath "$INSTDIR\help\en"
File "..\TDSProg\help\en\contents.xml"
File "..\TDSProg\help\en\HelpEnglish.htm"
File "..\TDSProg\help\en\style.css"
SetOutPath "$INSTDIR\help\en\HelpEnglish_files"
File "..\TDSProg\help\en\HelpEnglish_files\image001.png"
File "..\TDSProg\help\en\HelpEnglish_files\image002.png"
File "..\TDSProg\help\en\HelpEnglish_files\image003.png"
File "..\TDSProg\help\en\HelpEnglish_files\image004.png"
File "..\TDSProg\help\en\HelpEnglish_files\image005.png"
File "..\TDSProg\help\en\HelpEnglish_files\image006.png"
File "..\TDSProg\help\en\HelpEnglish_files\image007.png"
File "..\TDSProg\help\en\HelpEnglish_files\image008.png"
File "..\TDSProg\help\en\HelpEnglish_files\image009.png"
File "..\TDSProg\help\en\HelpEnglish_files\image010.png"
File "..\TDSProg\help\en\HelpEnglish_files\image011.png"
File "..\TDSProg\help\en\HelpEnglish_files\image012.png"
File "..\TDSProg\help\en\HelpEnglish_files\image013.png"
File "..\TDSProg\help\en\HelpEnglish_files\image014.png"
File "..\TDSProg\help\en\HelpEnglish_files\image015.png"
File "..\TDSProg\help\en\HelpEnglish_files\image016.png"
File "..\TDSProg\help\en\HelpEnglish_files\image017.png"
File "..\TDSProg\help\en\HelpEnglish_files\image018.png"
File "..\TDSProg\help\en\HelpEnglish_files\image019.png"
File "..\TDSProg\help\en\HelpEnglish_files\image020.png"
File "..\TDSProg\help\en\HelpEnglish_files\image021.png"
File "..\TDSProg\help\en\HelpEnglish_files\image022.png"
File "..\TDSProg\help\en\HelpEnglish_files\image023.png"
File "..\TDSProg\help\en\HelpEnglish_files\image024.png"
File "..\TDSProg\help\en\HelpEnglish_files\image025.png"
File "..\TDSProg\help\en\HelpEnglish_files\image026.png"
File "..\TDSProg\help\en\HelpEnglish_files\image027.png"
File "..\TDSProg\help\en\HelpEnglish_files\image028.png"
File "..\TDSProg\help\en\HelpEnglish_files\image029.png"
File "..\TDSProg\help\en\HelpEnglish_files\image030.png"
File "..\TDSProg\help\en\HelpEnglish_files\image031.png"
File "..\TDSProg\help\en\HelpEnglish_files\image032.png"
File "..\TDSProg\help\en\HelpEnglish_files\image033.png"
File "..\TDSProg\help\en\HelpEnglish_files\image034.png"
File "..\TDSProg\help\en\HelpEnglish_files\image035.png"
File "..\TDSProg\help\en\HelpEnglish_files\image036.png"
File "..\TDSProg\help\en\HelpEnglish_files\image037.png"
File "..\TDSProg\help\en\HelpEnglish_files\image038.png"
File "..\TDSProg\help\en\HelpEnglish_files\image039.png"
File "..\TDSProg\help\en\HelpEnglish_files\image040.png"
File "..\TDSProg\help\en\HelpEnglish_files\image041.png"
File "..\TDSProg\help\en\HelpEnglish_files\image042.png"
File "..\TDSProg\help\en\HelpEnglish_files\image043.png"
File "..\TDSProg\help\en\HelpEnglish_files\image044.png"
File "..\TDSProg\help\en\HelpEnglish_files\image045.png"
File "..\TDSProg\help\en\HelpEnglish_files\image046.png"
File "..\TDSProg\help\en\HelpEnglish_files\image047.png"
File "..\TDSProg\help\en\HelpEnglish_files\image048.png"
File "..\TDSProg\help\en\HelpEnglish_files\image049.png"
File "..\TDSProg\help\en\HelpEnglish_files\image050.png"
File "..\TDSProg\help\en\HelpEnglish_files\image051.png"
File "..\TDSProg\help\en\HelpEnglish_files\image052.png"
File "..\TDSProg\help\en\HelpEnglish_files\image053.png"
File "..\TDSProg\help\en\HelpEnglish_files\image054.png"
File "..\TDSProg\help\en\HelpEnglish_files\image055.png"
File "..\TDSProg\help\en\HelpEnglish_files\image056.png"
File "..\TDSProg\help\en\HelpEnglish_files\image057.png"
File "..\TDSProg\help\en\HelpEnglish_files\image058.png"
File "..\TDSProg\help\en\HelpEnglish_files\image059.png"
File "..\TDSProg\help\en\HelpEnglish_files\image060.png"
File "..\TDSProg\help\en\HelpEnglish_files\image061.png"
File "..\TDSProg\help\en\HelpEnglish_files\image062.png"
File "..\TDSProg\help\en\HelpEnglish_files\image063.png"
File "..\TDSProg\help\en\HelpEnglish_files\image064.png"
File "..\TDSProg\help\en\HelpEnglish_files\image065.png"
File "..\TDSProg\help\en\HelpEnglish_files\image066.png"
File "..\TDSProg\help\en\HelpEnglish_files\image067.png"
File "..\TDSProg\help\en\HelpEnglish_files\image068.png"
File "..\TDSProg\help\en\HelpEnglish_files\image069.png"
File "..\TDSProg\help\en\HelpEnglish_files\image070.png"
File "..\TDSProg\help\en\HelpEnglish_files\image071.png"
File "..\TDSProg\help\en\HelpEnglish_files\image072.png"
File "..\TDSProg\help\en\HelpEnglish_files\image073.png"
File "..\TDSProg\help\en\HelpEnglish_files\image074.png"
File "..\TDSProg\help\en\HelpEnglish_files\image075.png"
File "..\TDSProg\help\en\HelpEnglish_files\image076.png"
File "..\TDSProg\help\en\HelpEnglish_files\image077.png"
File "..\TDSProg\help\en\HelpEnglish_files\image078.png"
File "..\TDSProg\help\en\HelpEnglish_files\image079.png"
File "..\TDSProg\help\en\HelpEnglish_files\image080.png"
File "..\TDSProg\help\en\HelpEnglish_files\image081.png"
File "..\TDSProg\help\en\HelpEnglish_files\image082.png"
File "..\TDSProg\help\en\HelpEnglish_files\image083.png"
File "..\TDSProg\help\en\HelpEnglish_files\image084.png"
File "..\TDSProg\help\en\HelpEnglish_files\image085.png"
File "..\TDSProg\help\en\HelpEnglish_files\image086.png"
File "..\TDSProg\help\en\HelpEnglish_files\image087.png"
File "..\TDSProg\help\en\HelpEnglish_files\image088.png"
File "..\TDSProg\help\en\HelpEnglish_files\image089.png"
File "..\TDSProg\help\en\HelpEnglish_files\image090.png"
File "..\TDSProg\help\en\HelpEnglish_files\image091.png"
File "..\TDSProg\help\en\HelpEnglish_files\image092.png"
File "..\TDSProg\help\en\HelpEnglish_files\image093.png"
File "..\TDSProg\help\en\HelpEnglish_files\image094.png"
File "..\TDSProg\help\en\HelpEnglish_files\image095.png"
File "..\TDSProg\help\en\HelpEnglish_files\image096.png"
File "..\TDSProg\help\en\HelpEnglish_files\image097.png"
File "..\TDSProg\help\en\HelpEnglish_files\image098.png"
File "..\TDSProg\help\en\HelpEnglish_files\image099.png"
File "..\TDSProg\help\en\HelpEnglish_files\image100.png"
File "..\TDSProg\help\en\HelpEnglish_files\image101.png"
File "..\TDSProg\help\en\HelpEnglish_files\image102.png"
File "..\TDSProg\help\en\HelpEnglish_files\image103.png"
File "..\TDSProg\help\en\HelpEnglish_files\image104.png"
File "..\TDSProg\help\en\HelpEnglish_files\image105.png"
File "..\TDSProg\help\en\HelpEnglish_files\image106.png"
SectionEnd
Section "Help" SEC04
SetOutPath "$INSTDIR\help\en_ecm"
File "..\TDSProg\help\en_ecm\contents.xml"
File "..\TDSProg\help\en_ecm\HelpEnglish.htm"
File "..\TDSProg\help\en_ecm\style.css"
SetOutPath "$INSTDIR\help\en_ecm\HelpEnglish_files"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image001.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image002.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image003.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image004.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image005.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image006.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image007.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image008.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image009.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image010.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image011.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image012.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image013.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image014.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image015.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image016.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image017.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image018.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image019.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image020.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image021.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image022.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image023.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image024.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image025.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image026.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image027.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image028.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image029.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image030.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image031.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image032.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image033.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image034.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image035.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image036.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image037.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image038.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image039.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image040.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image041.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image042.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image043.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image044.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image045.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image046.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image047.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image048.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image049.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image050.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image051.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image052.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image053.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image054.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image055.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image056.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image057.png"
File "..\TDSProg\help\en_ecm\HelpEnglish_files\image058.png"
SetOutPath "$INSTDIR"
File "..\3EGM080680D9023_EN_D_TDS_PROG_UserManual_Engineering.pdf"
File "..\3EGM080680D9024_EN_D_TDS_PROG_UserManual_EndCustomer.pdf"
File "..\3EGM080680D9025_EN_C_TDS_PROG_Tutorial.pdf"
File "..\3EGM080680D0260_EN__TDS-PROG_ReleaseNote_2_6_0_0.pdf"
SectionEnd
Section -AdditionalIcons
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Manual-Engineering.lnk" "$INSTDIR\3EGM080680D9023_EN_D_TDS_PROG_UserManual_Engineering.pdf"
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Manual-EndCustomer.lnk" "$INSTDIR\3EGM080680D9024_EN_D_TDS_PROG_UserManual_EndCustomer.pdf"
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Guide.lnk" "$INSTDIR\3EGM080680D9025_EN_C_TDS_PROG_Tutorial.pdf"
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS Release Notes.lnk" "$INSTDIR\3EGM080680D0260_EN__TDS-PROG_ReleaseNote_2_6_0_0.pdf"
CreateShortCut "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -RegistrySettings
WriteRegStr HKCR ".mdp" "" "mdpfile"
WriteRegStr HKCR "mdpfile" "" "TDS-PROG Tool Project File"
WriteRegDWORD HKCR "mdpfile" "EditFlags" 0x00000000
WriteRegDWORD HKCR "mdpfile" "BrowserFlags" 0x00000008
WriteRegStr HKCR "mdpfile\DefaultIcon" "" "$\"$INSTDIR\TDSProg.exe$\",1"
WriteRegStr HKCR "mdpfile\shell" "" "Open"
WriteRegStr HKCR "mdpfile\shell\Open" "" "Open Project with TDS Prog Tool"
WriteRegStr HKCR "mdpfile\shell\Open\command" "" "$\"$INSTDIR\TDSProg.exe$\" $\"-o$\" $\"%1$\""
WriteRegStr HKCR "mdpfile\shell\Generate" "" "Generate Files with TDS Prog Tool"
WriteRegStr HKCR "mdpfile\shell\Generate\command" "" "$\"$INSTDIR\TDSProg.exe$\" $\"-g$\" $\"%1$\""
WriteRegStr HKCR "mdpfile\shell\Clean" "" "Clean Files with TDS Prog Tool"
WriteRegStr HKCR "mdpfile\shell\Clean\command" "" "$\"$INSTDIR\TDSProg.exe$\" $\"-c$\" $\"%1$\""
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\TDSProg.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\TDSProg.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) was successfully removed from your computer."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\3EGM080680D9023_EN_D_TDS_PROG_UserManual_Engineering.pdf"
Delete "$INSTDIR\3EGM080680D9024_EN_D_TDS_PROG_UserManual_EndCustomer.pdf"
Delete "$INSTDIR\3EGM080680D9025_EN_C_TDS_PROG_Tutorial.pdf"
Delete "$INSTDIR\3EGM080680D0260_EN__TDS-PROG_ReleaseNote_2_6_0_0.pdf"
Delete "$INSTDIR\help\en\HelpEnglish.htm"
Delete "$INSTDIR\help\en\contents.xml"
Delete "$INSTDIR\help\en\style.css"
Delete "$INSTDIR\help\en\HelpEnglish_files\image001.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image002.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image003.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image004.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image005.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image006.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image007.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image008.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image009.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image010.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image011.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image012.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image013.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image014.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image015.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image016.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image017.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image018.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image019.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image020.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image021.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image022.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image023.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image024.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image025.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image026.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image027.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image028.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image029.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image030.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image031.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image032.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image033.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image034.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image035.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image036.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image037.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image038.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image039.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image040.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image041.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image042.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image043.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image044.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image045.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image046.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image047.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image048.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image049.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image050.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image051.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image052.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image053.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image054.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image055.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image056.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image057.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image058.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image059.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image060.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image061.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image062.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image063.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image064.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image065.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image066.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image067.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image068.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image069.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image070.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image071.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image072.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image073.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image074.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image075.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image076.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image077.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image078.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image079.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image080.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image081.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image082.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image083.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image084.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image085.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image086.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image087.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image088.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image089.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image090.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image091.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image092.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image093.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image094.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image095.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image096.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image097.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image098.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image099.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image100.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image101.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image102.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image103.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image104.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image105.png"
Delete "$INSTDIR\help\en\HelpEnglish_files\image106.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish.htm"
Delete "$INSTDIR\help\en_ecm\contents.xml"
Delete "$INSTDIR\help\en_ecm\style.css"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image001.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image002.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image003.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image004.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image005.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image006.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image007.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image008.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image009.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image010.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image011.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image012.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image013.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image014.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image015.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image016.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image017.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image018.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image019.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image020.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image021.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image022.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image023.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image024.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image025.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image026.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image027.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image028.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image029.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image030.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image031.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image032.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image033.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image034.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image035.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image036.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image037.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image038.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image039.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image040.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image041.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image042.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image043.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image044.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image045.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image046.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image047.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image048.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image049.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image050.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image051.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image052.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image053.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image054.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image055.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image056.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image057.png"
Delete "$INSTDIR\help\en_ecm\HelpEnglish_files\image058.png"
Delete "$INSTDIR\QtXml4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\mfc42loc.dll"
Delete "$INSTDIR\MTScc.dll"
Delete "$INSTDIR\MTHelpViewer.dll"
Delete "$INSTDIR\MTAbout.dll"
Delete "$INSTDIR\MTGrid.dll"
Delete "$INSTDIR\MTResManager.dll"
Delete "$INSTDIR\TDSLib.dll"
Delete "$INSTDIR\TDSParseDLL.dll"
Delete "$INSTDIR\TDSParseDLL_Unicode.dll"
Delete "$INSTDIR\TDSOutput.dll"
Delete "$INSTDIR\Trace.dll"
Delete "$INSTDIR\TDSImportInterface.dll"
Delete "$INSTDIR\olexlsf.tlh"
Delete "$INSTDIR\olexlsf.tli"
Delete "$INSTDIR\olexlsf.dll"
Delete "$INSTDIR\TDSProg.exe"
Delete "$INSTDIR\olexlsf.dll"
Delete "$INSTDIR\makedlu.exe"
Delete "$INSTDIR\tar.exe"
Delete "$INSTDIR\gzip.exe"
Delete "$INSTDIR\zip.exe"
Delete "$INSTDIR\temp\exportFile.xls"
Delete "$INSTDIR\TDSXMLExportPlugin.dll"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\Uninstall.lnk"
Delete "$DESKTOP\TDS-PROG Tool.lnk"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS-PROG Tool.lnk"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Manual-Engineering.lnk"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Manual-EndCustomer.lnk"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS User Guide.lnk"
Delete "$SMPROGRAMS\MITRAC Tool Suite\MITRAC CC TDS-PROG\TDS Release Notes.lnk"
RMDir "$SMPROGRAMS\MITRAC Tool Suite\TDS-PROG2"
RMDir "$INSTDIR\help\en\HelpEnglish_files"
RMDir "$INSTDIR\help\en_ecm\HelpEnglish_files"
RMDir "$INSTDIR\help\en_ecm"
RMDir "$INSTDIR\help\en"
RMDir "$INSTDIR\help"
RMDir "$INSTDIR\temp"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKCR "mdpfile\DefaultIcon"
DeleteRegKey HKCR "mdpfile\shell\Open\command"
DeleteRegKey HKCR "mdpfile\shell\Open"
DeleteRegKey HKCR "mdpfile\shell\Generate\command"
DeleteRegKey HKCR "mdpfile\shell\Generate"
DeleteRegKey HKCR "mdpfile\shell\Clean\command"
DeleteRegKey HKCR "mdpfile\shell\Clean"
DeleteRegKey HKCR "mdpfile\shell"
SetAutoClose true
SectionEnd
Regards,
-Priyanka
MSG
13th April 2012 17:22 UTC
PLEASE use pastebin or an attachment for such huge amounts of code. ~_~
Yes, you can do both install and uninstall in one section, using the very simple code I gave you. Make sure that the default value of $variable is set to install, in case the installer skips the install/uninstall/reinstall page.
Afrow UK
13th April 2012 18:00 UTC
Also switch to MUI2.nsh (as you are using nsDialogs).
Stu
priyankaB
17th April 2012 06:23 UTC
The fix you gave me didn't work and now the uninstall is behaving in a weird manner.
May be my way of implementing the same is wrong.:(
Could you please check and verify. I have attached the script with this post.
-Priyanka
MSG
17th April 2012 06:36 UTC
Why are you calling the uninstaller? You can just as simply uninstall the previous version directly from your install section.