Failing section access by index at runtime
Hello,
I am seeing a strange thing:
I have several sections built using macros, they have index {S1} to {S5}.
The sections have empty name and have the /o setting to make them disabled by default.
Then, within the onInit handler, I call the following function to work on the {Sn} indexed sections.
Function InitializeSections
${ForEach} $i 1 5 + 1
StrCpy $P_SectionIndex "S$i"
ClearErrors
SectionGetText {$P_SectionIndex} $P_SectionName
IfErrors 0 +2
MessageBox MB_OK "Error!"
MessageBox MB_OK "Section Name: $P_SectionName"
(... do something else on the section with {$P_SectionIndex} index)
${Next}
FunctionEnd
The problem is that the code seems to access the sections by sequence instead of by name.
The error message is never shown.
I thought I would be able to access sections using their index stored in a variable, but it doesn't seem to work.
If I try to retrieve the text when P_SectionName is "S1" I get the very first section of the whole project, "S2" gets the second and so on, in other words it seems only the numeric part of the index is used. Am I missing something or do indexes only work by numeric index?
Thanks,
Mario