Is it possible to wrap 'that' in a function?
Good %time_of_day% to you gurus
I've decided to made an UI part of our installer more configurable (thus a bit more visually appealing) today and as part of that effort did some crazy experiments with sections to achieve an effect of flexibility.In short - the product is updated frequently and is complex so the sections part of a script is generated by an external program, besides there is a lot of variations of an installer so instead of making, say, 15 setup variations for each version released we decided to make sort of a "license" to exclude unnecessary "modules" from an installer.
It works in a way: installer opens, usual stuff happens, then user prompted for a license file, which looks like
<?xml version="1.0" encoding="utf-8" ?>
<license>
<module>ModuleOne</module>
<module>AnotherModule</module>
</license>
it is read and put in a list, then user sees a section tree (which is being configured by license now) and so on.
The machine-generated sections part looks like (simplified example):
var licSearchListInd ;index for iteration
var licSearchModule ;module name from a license file
Var licSectionIsFound ;indicates that the module was found in a section name
Var currModule ;the module in question
Section "manyAsOne" SECX
SetOutPath "$INSTDIR\bin\"
StrCpy $currModule "ModuleOne" ;one of the modules in question
${For} $licSearchListInd 0 $licenseListCount ;traverse license list
${List.Get} $licSearchModule licenseList $licSearchListInd
;look if module name is contained inside of a section name
${StrLoc} $licSectionIsFound $currModule $licSearchModule "<"
;returns position, can be 0 or more, empty string if not found
${If} $licSectionIsFound != ""
File "$%SOME_ROOT%\release\bin\SomeFile.dll"
${EndIf}
${Next}
StrCpy $currModule "AnotherModule"
${For} $licSearchListInd 0 $licenseListCount
${List.Get} $licSearchModule licenseList $licSearchListInd
${StrLoc} $licSectionIsFound $currModule $licSearchModule "<"
${If} $licSectionIsFound != ""
File "$%SOME_ROOT%\release\bin\SomeClient.dll"
File "$%SOME_ROOT%\release\bin\SomeServer.dll"
${EndIf}
${Next}
;another 300 modules
SectionEnd
(I had an alternative earlier that made unnecessary modules unchecked, uncheckable and invisible but that produced a bad looking gray checkbox on a section group container, and irremovable "+" sign if all sections/modules of a section group were hidden. The solution above solves that)
Uh, now, the question - is there a way to put that repeating part in a function somehow? The problem is with variable amount of instructions like File... I know it won't make any performance difference but I just want to make script look a bit less... messy :confused: