CombinedUnInstaller: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(FA: Some more identation to code. FA: "Page author" line.)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{PageAuthor|Jan}}
== Description ==
== Description ==


Line 60: Line 62:
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]]
[[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