Archive: Get Section Name


Get Section Name
Section "Required Files" req
....
SectionEnd

Suppose this is the first section in my nsi file, how can I return it's name (req) ?


I don't know if you can return "req" as a name. I think it is just a handle to a section (for runtime manipulation).


req is just a constant name for the Section index.
e.g. if "Required Files" is your first Section, ${req} will be 0.

-Stu


The thing is, I want to save the selected components to the registry and I already have that done but components keep changing in each update. For example section 5 in this version might be section 6 in the next. So I need to get the section name, since it's static. Is it possible to do that ?


Yes, use SectionGetText.

-Stu


But my installer is multi-lingual, the section text varies with each language. I need something static to define each section. Any ideas ?


How about:

Var SelectedSectionNum

Function .onInit
StrCpy $SelectedSectionNum 0
FunctionEnd

Section "Main Application" Sec1
WriteRegStr HKLM "Software\MyApp\Sections" "$SelectedSectionNum" "MainApp"
IntOp $SelectedSectionNum $SelectedSectionNum + 1
SectionEnd

Section "Skins" Sec2
WriteRegStr HKLM "Software\MyApp\Sections" "$SelectedSectionNum" "Skins"
IntOp $SelectedSectionNum $SelectedSectionNum + 1
SectionEnd

Section "Documents" Sec3
WriteRegStr HKLM "Software\MyApp\Sections" "$SelectedSectionNum" "Docs"
IntOp $SelectedSectionNum $SelectedSectionNum + 1
SectionEnd


-Stu