Archive: Wrestling with Sections.nsh macros


Wrestling with Sections.nsh macros
For the life of me I can't get any of these working.

I'd assume these lines would unselect these hidden sections


!insertmacro ClearSectionFlag -FLIGHTWEATHERDATA 1
!insertmacro ClearSectionFlag -FLIGHTVPFDATA 1

Instead they unselect a subsection called FCMAIN which they are not even in!

And when trying to check if a section is selected or not, I assumed this macro would do that...

!insertmacro SectionFlagIsSet HOME 1 0 NoHome

But when one fails, all the rest I macro in fail no matter what. And when one succeeds, they all do, regardless of the state of the actual section.

Also, I don't think SectionGetSize picks up on any AddSizes you have in that section. Unless I'm using all that wrong as well. I have my SectionGetSize before my AddSize stuff

Attach your script, or at least a minimal working version. Then maybe someone can tell you what's going wrong.


Ok, here is my script. This is a callback after the components page. My setup has 3 different directories to install components too, so I want the directory pages to display 3 difference "Space Required" things. Thats another problem though. Right now, I can't get this to have the right drive spaces by the end. Either they all pass, or they all fail. My sections are set up like this.

FCMAIN
HOME
DATA
FLIGHTWEATHER
-FLIGHTWEATHERDATA
FLIGHTVPF
-FLIGHTVPFDATA
Help

I only want the hidden sections which are paired with the nonhidden sections (FLIGHTVPF and -FLIGHTVPFDATA for example) to be installed if their non hidden counterpart is installed. Also, those powers of 2 I added to the drive totals, I only did that so far so I could test this out without having to add actual files. It will be replaced with the $R0 that is filled with the SectionGetSize

So far I think the core of my problem is that no matter what, those section.nsh macros always just check that FCMAIN subsection. If HOME or DATA are not selected, all the macros fail and my drives all end up at 0. If they are both selected, all my drives always end up at 85, 10, and 32 (meaning all the components are going to be installed) even if FLIGHTVPF or HELP or something is disabled. What I don't get is, I know I'm passing it in right, because I even added messageboxes to the macros for a little while so that I knew the parameters were getting passed correctly. Any help here? Also, those ClearSectionFlag macros always clear FCMAIN instead of the sections I specified.


You were calling all Section commands (macro or otherwise), incorrectly.
Make sure that you set the section indexes for your sections as well.
See the attached script and make the necessary changes to your script.


Thanks, that got it.