Question

I'm trying fill setup section values with {param} and {ini} like this:

VersionInfoProductName={param:NAME|My Product}
VersionInfoTextVersion={ini:ExpandConstant({src})\config.ini,setupValues,version|unknow}

But it is not working, in EXE properties is showing {param:NAME|My Product} I also tried with GetIniString but same result.

How can I put ini values in Setup section?

Was it helpful?

Solution

You cannot use any of the constants you have used, because both directives you're trying to fill need to be filled at compilation time. You will need to use the preprocessor function equivalent, because only the preprocessor can fill the directive values before the compilation starts.

The preprocessor's equivalent for reading from INI files is the ReadIni function, which you can use the way which follows. Assuming you have a config.ini file stored in the same location as the script with this content:

[setupValues]
version=1.2.3.0

You can fill the value of the VersionInfoVersion directive this way. I have used this directive, since the value of the VersionInfoTextVersion directive is displayed only on Windows 98 below systems and I believe you're not running such an old system to ever verify this:

[Setup]
VersionInfoVersion={#ReadIni(SourcePath + "config.ini", "setupValues", "version", "")}

Note, that the SourcePath variable used in the above code is a predefined variable that can be evaluated from preprocessor. The result you can then verify by checking the setup binary file properties and you will see e.g. this:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top