CombinedUnInstaller: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page)
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageAuthor|Jan}}
== Description ==
== Description ==


Line 4: Line 6:


== 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 33:
;functions
;functions
Function .onInit
Function .onInit
   MessageBox MB_YESNO|MB_ICONEXCLAMATION "YES to install. NO to uninstall."\
   MessageBox MB_YESNO|MB_ICONEXCLAMATION \
  IDNO +3
            "YES to install. NO to uninstall." IDNO +3
  Call usUnSections
    Call usUnSections
  Goto +2
    Goto +2
   Call usSections
   Call usSections
FunctionEnd
FunctionEnd
Line 51: Line 55:
   SectionSetText ${mbunInst} ""
   SectionSetText ${mbunInst} ""
FunctionEnd
FunctionEnd
;eof</highlight-nsis>
;eof
</highlight-nsis>


== Examples ==
== Examples ==
This script was used in [http://xpy.sourceforge.net xpy]
 
This script was used in [http://sourceforge.net/projects/xpy/ xpy]
 
[[Category:Code Examples]]

Latest revision as of 04:42, 3 December 2005

Author: Jan (talk, contrib)


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