Skip to content
⌘ NSIS Forum Archive

Is it possible to use variable within a symbol?

6 posts

zjckwht#

Is it possible to use variable within a symbol?


Section 'blah' sec1
.......
SectionEnd

Section 'blah' sec2
.......
SectionEnd

.............


Function ComponentShow
${For} $R1 0 56
ReadINIStr $R0 "$PLUGINSDIR\secs.ini" "setup" "sec$R1"
SectionSetText ${sec$R1} $0
${Next}
FunctionEnd



In this case, how to make ${sec$R1} work?

I don't want to directly use the counter $R1 value for the section_index parameter. Coz the index may not match the specified sections if conditional compilation is used
bholliger#
Hi zjckwht!

Due to the fact that you can't mix compile time with run-time instructions it is not possible.

I've created a wiki page with some explanations. Have a look:



Have a nice day!

Cheers

Bruno
Afrow UK#
You can just specify $R1 instead of ${sec$R1}. SectionSetText requires an integer parameter which specifies the Section index. ${sec1} for example will be a constant defined with the value of 0.

-Stu
bholliger#
Hi Stu!

Yes, that's true. But the problem is, if another section is inserted in between, the indexes will change and almost every entry of the ini-file must be changed as well. The solution of get/set-texts is not depending on indexes. Therefore it is easier to handle.

Cheers

Bruno