Skip to content
⌘ NSIS Forum Archive

Turn off read-only, hidden section

10 posts

Guest#

Turn off read-only, hidden section

my code look like this

section "something" SEC01
SectionIn RO
...
sectionend

section "-hidden" SEC02

SectionEnd

Function .onInit

FunctionEnd

Function CustomPage
/////// I'm trying to turn SEC01 and SEC02 with macro in
//////// Sections.nsh but it didn't work
FunctionEnd
Afrow UK#
Use SectionSetText ${SEC02} "text" to make the section visible on the components page.

-Stu
Guest#
here the code

!macro OFFSEC NUMBER
StrCpy $R1 "1"

loop:
StrCpy $R1 $R1 + 1
!insertmacro SetSectionFlag ${SEC0$R1} ${SECTION_OFF}
IntCmp $R1 "$NUMBER" +2 0
Goto loop

!macroend

thank you guy i found down how to turn this off, i got another trouble, with this code
Afrow UK#
You are confusing run-time commands with compile-time commands.

You must do this:
!macro OFFSEC
!insertmacro SetSectionFlag ${SEC01} ${SECTION_OFF}
!insertmacro SetSectionFlag ${SEC02} ${SECTION_OFF}
!insertmacro SetSectionFlag ${SEC03} ${SECTION_OFF}
...etc
!macroend

-Stu
kichik#
There is a way to do it in a loop. If it is known that the sections are sequential then it is known their ids are also sequential. So, if you have:
Section "one" SEC1
SectionEnd
Section "two" SEC2
SectionEnd
Section "three" SEC3
SectionEnd
Something like the following should work:
StrCpy $0 ${SEC1}
loop: IntOp $0 $0 + 1
IntCmp $0 ${SEC3} 0 0 end
!insertmacro UnselectSection $0
Goto loop
end:
Guest#
thanks you guy

i know how to turn all the section off, there something wrong, this is real code

Section "-Uninstall"
Call Uninstall
SectionEnd

Section SEC1

SectionEnd

Section SEC2

SectionEnd

Section SEC3

SectionEnd

Function CustomPageLeave
Modify:


Repair:


Uninstall:
Turn off SEC1, SEC2, SEC3
The Uninstall working, but the ProgressBar have been stop in the middle,
If I turn off with no loop the progreeabar go to complete.
FunctionEnd


Function Uninstall
GetFlags .....
FunctionEnd
Guest#
i think section set flags section can't be loop or use any macro....

SetionSetFlags ${SEC02} "0"

normally unselected a section we have to put this command under sections ... if include macro Section.nsh then the complier can't recognize which section to set.... am i right you guy???