zjckwht
11th November 2006 20:45 UTC
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
11th November 2006 23:29 UTC
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
zjckwht
12th November 2006 02:41 UTC
AWESOME!!!
That's exactly what I need, thanks thanks thanks for your help. Nice job.
bholliger
12th November 2006 02:46 UTC
You're welcome!
Afrow UK
12th November 2006 11:43 UTC
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
12th November 2006 12:12 UTC
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