IfFileExists Changes Section Flags: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(Example of changing Components Section state during installation.) |
|||
Line 3: | Line 3: | ||
== The Script == | == The Script == | ||
<highlight-nsis!include Sections.nsh | <highlight-nsis>!include Sections.nsh | ||
Name TestSelectSection | Name TestSelectSection |
Revision as of 16:51, 4 February 2006
Description
IfFileExists determines whether certain component sections are checked or unchecked.
The Script
!include Sections.nsh Name TestSelectSection OutFile "TestSelectSection.exe" Page components Page instfiles ShowInstDetails show ; This file will exist on most computers Section /o "autoexec.bat detected" autoexec_detected MessageBox MB_OK autoexec SectionEnd Section /o "Boot.ini detected" boot_detected MessageBox MB_OK boot SectionEnd Section /o "non-existing file detected" missing_detected MessageBox MB_OK missing SectionEnd Function .onInit IfFileExists C:\autoexec.bat AutoexecExists PastAutoexecCheck AutoexecExists: SectionGetFlags "${autoexec_detected}" $0 IntOp $0 $0 | ${SF_SELECTED} SectionSetFlags "${autoexec_detected}" $0 PastAutoexecCheck: IfFileExists C:\boot.ini BootExists PastBootCheck BootExists: !insertmacro SelectSection ${boot_detected} PastBootCheck: IfFileExists C:\xyz_missing.xyz MissingExists PastMissingCheck MissingExists: !insertmacro SelectSection ${missing_detected} PastMissingCheck: FunctionEnd