开发者

Reading constants from .ini file for Inno Setup compilation

开发者 https://www.devze.com 2023-04-12 06:37 出处:网络
I wrote an inn开发者_如何学编程osetup script in order to prepare an installer requiring a password.

I wrote an inn开发者_如何学编程osetup script in order to prepare an installer requiring a password. In order to keep separated the password from the innosetup code, I prepared an .ini file from where innosetup should read the password. Both archives are in the same folder together with the application to compile.

---- inno.iss -----

#define MyPswd "install.ini"
..............

[Setup]
..............
;Password=test                                 <- this works
Password={ini:{#MyPswd},Settings,pswd|test}    <- this doesnt work
............

---- install.ini -----

[Settings]
pswd=test

During installation I get a password error when I enter "test". With the direct Password=test, it installs correctly.

What am I doing wrong?

InnoSetup Compiler 5.4.2(u)

win 7 64bit


The Password directive can not contain runtime constants and so the password is literally {ini:{#MyPswd},Settings,pswd|test}. If you want to include the password at compile time, you will need to use ISPP to read the ini file value and {#emit} it:

{#ReadIni(MyPswd, "Settings", "pswd", "test")}

(Untested but should work)

0

精彩评论

暂无评论...
验证码 换一张
取 消