Archive: Howto/Template for ini2var parsing?


Howto/Template for ini2var parsing?
Hi together,

we plan an installer on template basis. Therefor we want to include (by parsing) all values from an ini-file as value.

E.g. in INI file:
MYENTRY=MyValue

Result in NSIS:
var MYENTRY
StrCpy MYENTRY "MyValue"

or

!define MYENTRY "MyValue"

Are there any existing macros/functions for this behaviour?

Thanks a lot,
Denis


The EnumINI plugin comes close, but I get the feeling you want to parse the values at compile time, not at install time. I don't know of a macro or function that does the former, but if you make a separate program to convert the INI file into a list of !defines that can be !included, you can use !execute or !system to run it at compile time.


Our goal is one ini file where we set all defines/vars as needed and the project is then ready to compile.
So yes, we will need the parsed ini-var-values at compile time.
Anyway, we will have a look at the Enum Plugin too, Thanks.


The ini-file is auto created or what? Because simply you could build a header that'd be included in your script.


Originally posted by Red Wine
The ini-file is auto created or what? Because simply you could build a header that'd be included in your script.
Hi RedWine,

yes, the file will be autogenerated from a different application (thats our plan). We thought also about a simple head file (with !defines etc) but droped that due to the reason that it doesn't offer interoperability (with other platforms like PHP etc).

Still, you could build a parser with NSIS which would read the ini-file and write the appropriate nsh-file.