CombinedUnInstaller: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Spelling fix) |
(FA: Some more identation to code. FA: "Page author" line.) |
||
Line 4: | Line 4: | ||
== Script Code == | == Script Code == | ||
<highlight-nsis>;combined unInstaller by jan t. sott | |||
<highlight-nsis> | |||
;combined unInstaller by jan t. sott | |||
!include "Sections.nsh" | !include "Sections.nsh" | ||
Line 29: | Line 31: | ||
;functions | ;functions | ||
Function .onInit | Function .onInit | ||
MessageBox MB_YESNO|MB_ICONEXCLAMATION "YES to install. NO to uninstall." | MessageBox MB_YESNO|MB_ICONEXCLAMATION \ | ||
"YES to install. NO to uninstall." IDNO +3 | |||
Call usUnSections | |||
Goto +2 | |||
Call usSections | Call usSections | ||
FunctionEnd | FunctionEnd | ||
Line 51: | Line 53: | ||
SectionSetText ${mbunInst} "" | SectionSetText ${mbunInst} "" | ||
FunctionEnd | FunctionEnd | ||
;eof</highlight-nsis> | ;eof | ||
</highlight-nsis> | |||
== Examples == | == Examples == | ||
This script was used in [http://sourceforge.net/projects/xpy/ xpy] | This script was used in [http://sourceforge.net/projects/xpy/ xpy] | ||
Page author: [[User:Jan|Jan]] |
Revision as of 20:31, 29 April 2005
Description
The Combined UnInstaller (CUIN) combines both, installer and uninstaller, in one executable with a shared components page. Depending on the users preferences, different sections will be displayed.
Script Code
;combined unInstaller by jan t. sott !include "Sections.nsh" Name "combined unInstaller 0.1" OutFile "cuin.exe" AutoCloseWindow true Page Components Page InstFiles ;sections SubSection /e "Installer" ssInst Section "Installer" mbInst MessageBox MB_OK "Successfully installed." SectionEnd SubSectionEnd SubSection /e "Uninstaller" ssUninst Section "Uninstaller" mbUninst MessageBox MB_OK "Successfully uninstalled." SectionEnd SubSectionEnd ;functions Function .onInit MessageBox MB_YESNO|MB_ICONEXCLAMATION \ "YES to install. NO to uninstall." IDNO +3 Call usUnSections Goto +2 Call usSections FunctionEnd Function usSections SectionSetText ${ssUninst} "MessageBox" !insertmacro UnSelectSection "${ssInst}" SectionSetText ${ssInst} "" !insertmacro UnSelectSection "${mbInst}" SectionSetText ${mbInst} "" FunctionEnd Function usUnSections SectionSetText ${ssInst} "MessageBox" !insertmacro UnSelectSection "${ssUninst}" SectionSetText ${ssUninst} "" !insertmacro UnSelectSection "${mbUninst}" SectionSetText ${mbunInst} "" FunctionEnd ;eof
Examples
This script was used in xpy
Page author: Jan