SectionsFlags: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
== Download Link == | == Download Link == | ||
[[File:Zip.gif]] [http://forums.winamp.com/attachment.php?s= | [[File:Zip.gif]] [http://forums.winamp.com/attachment.php?s=9a45f721526b0833445d8df1ef580a27&postid=1845800] (4 KB) | ||
== Description == | == Description == | ||
Line 9: | Line 9: | ||
== Usage == | == Usage == | ||
<highlight-nsis> | <highlight-nsis> | ||
Section "-" | |||
${SectionWriteReg} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
SectionEnd | |||
Function .onInit | Function .onInit | ||
${SectionResetFlags} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
FunctionEnd | FunctionEnd | ||
Function Uninstall | Function Uninstall | ||
${SectionGetValues} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
FunctionEnd | FunctionEnd | ||
Line 36: | Line 34: | ||
; Section define/macro header file | ; Section define/macro header file | ||
; See this header file for more info | ; See this header file for more info | ||
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SectionsFlags_exam" | |||
! | !define DEBUG | ||
!include " | |||
!include "SectionFunc.nsh" | |||
;${SectionReadReg} | |||
${SectionResetFlags} | |||
${SectionWriteReg} | |||
;-------------------------------- | ;-------------------------------- | ||
Line 61: | Line 63: | ||
SectionIn RO | SectionIn RO | ||
Call Uninstall | Call Uninstall | ||
SectionEnd | SectionEnd | ||
Section "Group 1 - Option 1" g1o1 | Section "Group 1 - Option 1" g1o1 | ||
DetailPrint "Installed Section | SectionGetText ${g1o1} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section /o "Group 1 - Option 2" g1o2 | Section /o "Group 1 - Option 2" g1o2 | ||
DetailPrint "Installed Section | SectionGetText ${g1o2} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section /o "Group 1 - Option 3" g1o3 | Section /o "Group 1 - Option 3" g1o3 | ||
DetailPrint "Installed Section | SectionGetText ${g1o3} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section "Group 2 - Option 1" g2o1 | Section "Group 2 - Option 1" g2o1 | ||
DetailPrint "Installed Section | SectionGetText ${g2o1} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section /o "Group 2 - Option 2" g2o2 | Section /o "Group 2 - Option 2" g2o2 | ||
DetailPrint "Installed Section | SectionGetText ${g2o2} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section /o "Group 2 - Option 3" g2o3 | Section /o "Group 2 - Option 3" g2o3 | ||
DetailPrint "Installed Section | SectionGetText ${g2o3} $0 | ||
DetailPrint "Installed Section $0" | |||
SectionEnd | SectionEnd | ||
Section "-" | Section "-" | ||
${SectionWriteReg} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
SectionEnd | SectionEnd | ||
Function .onInit | Function .onInit | ||
${SectionResetFlags} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
FunctionEnd | FunctionEnd | ||
Function Uninstall | Function Uninstall | ||
${SectionGetValues} HKLM "${PRODUCT_UNINST_KEY}" "Sections" | |||
${Section} ${g2o3} | |||
${Section} | |||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 2 - Option 3" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 2 - Option 3" | ||
${SectionEnd} | ${SectionEnd} | ||
${Section} | ${Section} ${g2o2} | ||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 2 - Option 2" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 2 - Option 2" | ||
${SectionEnd} | ${SectionEnd} | ||
${Section} | ${Section} ${g2o1} | ||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 2 - Option 1" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 2 - Option 1" | ||
${SectionEnd} | ${SectionEnd} | ||
${Section} | ${Section} ${g1o3} | ||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 1 - Option 3" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 1 - Option 3" | ||
${SectionEnd} | ${SectionEnd} | ||
${Section} | ${Section} ${g1o2} | ||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 1 - Option 2" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 1 - Option 2" | ||
${SectionEnd} | ${SectionEnd} | ||
${Section} | ${Section} ${g1o1} | ||
${Repair} | ${Repair} | ||
DetailPrint " | DetailPrint "Repaired Group 1 - Option 1" | ||
${Remove} | ${Remove} | ||
DetailPrint " | DetailPrint "Removed Group 1 - Option 1" | ||
${SectionEnd} | ${SectionEnd} | ||
Revision as of 22:31, 16 January 2006
Author: Tu Tong (talk, contrib) |
Download Link
[1] (4 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" !define DEBUG !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