Marshall7a
16th February 2005 01:02 UTC
Get Current Section Index
In my program, an active 'currently-being-installed' section needs to know it's own section index number.
For example:
Section "Component X"
GetCurrentSectionIndex $R1
WriteINIStr "$INSTDIR\install.ini" CHOICES1 Component $R1
SectionEnd
What would I use in place of "GetCurrentSectionIndex"?
I know it doesn't change at runtime but when I have just under 900 sections that need this info, it would save me a lot of time if I didn't have to enter the number in the script manually.
Anders
16th February 2005 04:20 UTC
Section "Component X" SEC_COMPONENTX
WriteINIStr "$INSTDIR\install.ini" CHOICES1 Component ${SEC_COMPONENTX}
SectionEnd
kichik
16th February 2005 07:12 UTC
You could join the section deceleration and the WriteINIStr in a macro so you wouldn't have to maintain both lines. But the easier solution is looping through all the sections and write a value if a section is enabled. Since the indexes start with 0 and end with the last section's index, it shouldn't be hard if you know what the last section is. If you don't, you can add a dummy section or wait for SectionGetFlags to raise the error flag. SectionGetFlags raises the error flag when the section index is out of range.
Marshall7a
16th February 2005 10:11 UTC
Many thanks.
In the end I realised that only one section in the group will ever be checked. I know the start number and end number so I just looped through all the setions to find the one that was checked.