SectionsFlags: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
mNo edit summary
Line 2: Line 2:


== Download Link ==
== Download Link ==
[[File:Zip.gif]] [http://nsis.sourceforge.net/mediawiki/images/9/92/SectionFlags.zip SectionFlags.zip] (4 KB)
<attach>SectionFlags.zip</attach>


== Description ==
== Description ==

Revision as of 11:33, 18 January 2006

Author: Tu Tong (talk, contrib)


Download Link

SectionFlags.zip (3 KB)

Description

These macros can remember or set section flags.

Usage

  Section "-"
    ${SectionWriteReg} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
  SectionEnd
 
  Function .onInit
    ${SectionResetFlags} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
  FunctionEnd
 
  Function Uninstall
    ${SectionGetValues} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
  FunctionEnd

Example

; SectionsFlags.nsi
;
; This example demonstrates how to control section flags.
 
;--------------------------------
 
; Section define/macro header file
; See this header file for more info
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SectionsFlags_exam"
 
!include "SectionFunc.nsh"
;${SectionReadReg}
${SectionResetFlags}
${SectionWriteReg}
 
;--------------------------------
 
Name "SectionsFlags Example"
OutFile "SectionsFlags_exam.exe"
 
ShowInstDetails show
;--------------------------------
 
; Pages
 
Page components
Page instfiles
 
;--------------------------------
 
; Sections
 
Section !Required
  SectionIn RO
  Call Uninstall
SectionEnd
 
Section "Group 1 - Option 1" g1o1
  SectionGetText ${g1o1} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section /o "Group 1 - Option 2" g1o2
  SectionGetText ${g1o2} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section /o "Group 1 - Option 3" g1o3
  SectionGetText ${g1o3} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section "Group 2 - Option 1" g2o1
  SectionGetText ${g2o1} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section /o "Group 2 - Option 2" g2o2
  SectionGetText ${g2o2} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section /o "Group 2 - Option 3" g2o3
  SectionGetText ${g2o3} $0
  DetailPrint "Installed Section $0"
SectionEnd
 
Section "-"
  ${SectionWriteReg} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
SectionEnd
 
Function .onInit
  ${SectionResetFlags} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
FunctionEnd
 
Function Uninstall
 
  ${SectionGetValues} HKLM "${PRODUCT_UNINST_KEY}" "Sections"
 
  ${Section} ${g2o3}
    ${Repair}
      DetailPrint "Repaired Group 2 - Option 3"
    ${Remove}
      DetailPrint "Removed Group 2 - Option 3"
  ${SectionEnd}
 
  ${Section} ${g2o2}
    ${Repair}
      DetailPrint "Repaired Group 2 - Option 2"
    ${Remove}
      DetailPrint "Removed Group 2 - Option 2"
  ${SectionEnd}
 
  ${Section} ${g2o1}
    ${Repair}
      DetailPrint "Repaired Group 2 - Option 1"
    ${Remove}
      DetailPrint "Removed Group 2 - Option 1"
  ${SectionEnd}
 
  ${Section} ${g1o3}
    ${Repair}
      DetailPrint "Repaired Group 1 - Option 3"
    ${Remove}
      DetailPrint "Removed Group 1 - Option 3"
  ${SectionEnd}
 
  ${Section} ${g1o2}
    ${Repair}
      DetailPrint "Repaired Group 1 - Option 2"
    ${Remove}
      DetailPrint "Removed Group 1 - Option 2"
  ${SectionEnd}
 
  ${Section} ${g1o1}
    ${Repair}
      DetailPrint "Repaired Group 1 - Option 1"
    ${Remove}
      DetailPrint "Removed Group 1 - Option 1"
  ${SectionEnd}
 
  DetailPrint "*******************************"
FunctionEnd