Archive: Is it possible to use variable within a symbol?


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

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:

http://nsis.sourceforge.net/Set_sect...rding_ini_file

Have a nice day!

Cheers

Bruno


AWESOME!!!

That's exactly what I need, thanks thanks thanks for your help. Nice job.


You're welcome!


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


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