Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine Inno Setup preprocessor #define from other #defines [duplicate]

I have an Inno Setup script.

In this Inno Setup script is a #define called InstallParameters. This is where the command line arguments for a program will go. The command line arguments will be any of four flags, /v, /i, /a, /c followed by arguments. For example, here would be an average input into InstallParameters:

#define InstallParameters "/v Local Area Connection /i 111.11.11.11"

Or:

#define InstallParameters "/a Device Name /c Customer Name"

Or:

#define InstallParameters "/v Local Area Connection /i 111.11.11.11 /a Device Name /c Customer Name"

Or any combination of a flag followed by an argument.

What I would like to do is make the four arguments into variables themselves, an amalgamation of #define.

Here is my ideal (please note that the syntax used to combine the #defineis entirely fictitious):

#define Connection "/v Local Area Connection"
#define IPaddress "/i 1.1.1.1"
#define DeviceName "/a Device Name"
#define CustName "/c Customer"

#define InstallParameters "{#Connection} {#IPaddress} {#DeviceName} {#CustName}"

Alas, none of the blind attempts I've tried have worked (some of them compile, though, which is nice).

Honestly, I don't know if this is a Pascal thing or an Inno Setup script thing. My attempts at the googles haven't resulted in anything worthwhile, because I don't know enough about either language/script to ask a worthwhile query.

Does anyone know if this sort of thing -- an amalgamation of #define -- is possible? And, if yes, how to do it?

like image 896
Bob Avatar asked Oct 29 '25 01:10

Bob


1 Answers

#define directive can be followed by a C-like expression.

In the expression, you can use + operator to concatenate strings (what you cannot actually use in C):

#define InstallParameters Connection + " " + IPaddress + " " + DeviceName + " " + CustName

See also Inno Setup Preprocessor: Expression Syntax. Though it is helpful only partially.

like image 168
Martin Prikryl Avatar answered Oct 30 '25 22:10

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!