compile vs execution INI file

163 views
Skip to first unread message

Frederic Luc

unread,
Jul 10, 2021, 2:31:07 PM7/10/21
to innosetup

Hello,

With GetIniString, i can well read the value contain in an INI file.

BUT

i have define this at the beginning my programm

#define w_name_of_server ReadIni("c:\temp\myinifile.ini",'SERVER', 'name', 'DEFAULT')

and it works only at the compilation not during the execution

if i change the value contain in myinifile.ini it work no more

an idea ?

same problem with SourceDir

i need to recover the value contain in myinifile.ini

how to do it ?

Thanks forward


José Gonçalves

unread,
Jul 11, 2021, 1:58:43 AM7/11/21
to innosetup
You're using ISSP which runs at compile time.
You have to use Pascal Scripting, and especially this function GetIniString : https://jrsoftware.org/ishelp/index.php?topic=isxfunc_getinistring 

Martijn Laan

unread,
Jul 12, 2021, 6:22:52 AM7/12/21
to inno...@googlegroups.com
Op 10-7-2021 om 20:31 schreef Frederic Luc:
i have define this at the beginning my programm

#define w_name_of_server ReadIni("c:\temp\myinifile.ini",'SERVER', 'name', 'DEFAULT')

and it works only at the compilation not during the execution

See https://jrsoftware.org/ishelp/index.php?topic=consts&anchor=ini

To make it work with SourceDir the entry also needs to have the external flag set.

Greetings,
Martijn

Frederic Luc

unread,
Aug 29, 2021, 12:52:52 PM8/29/21
to innosetup
Hi,  To make it work with SourceDir the entry also needs to have the external flag set.

What you mean ?

Thanks forward

i have still the problem.

best regards

Frederic Luc

unread,
Aug 29, 2021, 12:56:23 PM8/29/21
to innosetup
how to do something like that ?
SourceDir="#GetIniString('SERVEUR', 'nam'e, 'DEFAULT', 'c:\temp\myinitfile.ini')"

Le Monday, July 12, 2021 à 12:22:52 PM UTC+2, Martijn Laan a écrit :

Eivind Bakkestuen

unread,
Aug 29, 2021, 9:18:38 PM8/29/21
to inno...@googlegroups.com
Did you read the docs in Martijn's link?

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/f91abbef-a88c-4d8f-a64c-cd15ee922062n%40googlegroups.com.

José Gonçalves

unread,
Aug 30, 2021, 4:17:37 AM8/30/21
to innosetup
Have you tried this?
SourceDir={ini:c:\temp\MyProg.ini,SERVEUR,name|DEFAULT}

Frederic Luc

unread,
Oct 3, 2021, 12:27:23 PM10/3/21
to innosetup
Hi if i try this, i receive the following:

Compiler Error
Unknown filename prefix " {ini:"

What's wrong ?

thanks forward

José Gonçalves

unread,
Oct 5, 2021, 12:05:17 AM10/5/21
to innosetup
Correct, I get the same :
---------------------------
Compiler Error
---------------------------
Line 39:

Unknown filename prefix "{ini:"
---------------------------
OK   
---------------------------

Then, there's no other choice than using the Preprocessor now. 

Gavin Lambert

unread,
Oct 5, 2021, 12:55:12 AM10/5/21
to inno...@googlegroups.com
On 4/10/2021 5:27 am, Frederic Luc wrote:
> Hi if i try this, i receive the following:
>
> Compiler Error
> Unknown filename prefix " {ini:"
>
> What's wrong ?

Of course that can't possibly work. As the documentation clearly
indicates, {ini:...} is read at runtime and SourceDir is required at
compile time.

As Martijn pointed out, for *individual specific [Files] entries* you
can use {ini:...} in their Source provided that you also use the
'external' flag, which will copy a file from one place on the user's
machine to another at runtime. This is only rarely useful.


The main problem here is that you keep asking questions about specific
bits of code and never explain what you're actually trying to do. This
makes it very hard to give you any kind of actually useful answer.

Where is the ini file, is it on your development machine or is it on the
user's machine? Why are you trying to read a path from it to choose
where to find files to be installed? What purpose does it serve? Where
are these files located?
Reply all
Reply to author
Forward
0 new messages