inno-setup

Emit new line in Inno Setup preprocessor


When using Inno Setup preprocessor to generate a multi-line output, like for example in these answers of mine:

I always have to switch to the C-style string literals using #pragma parseroption directive, because with C-style string literals, I can use \n:

#pragma parseroption -p-

#define TwoLines "line1\nline2\n"

#pragma parseroption -p+

I haven't found any way to emit a new-line character in the default Pascal-style string literals.

In a real Pascal (Script) string, one can use #13#10. But that does not work in the preprocessor. Neither there's an equivalent of Pascal Chr function.

Is there any other way to emit a new line in the Pascal-style string literals?


Solution

  • There's NewLine macro available in Inno Setup 6.


    If you are on an older version of Inno Setup, you can define the macro in your own script. It's defined as:

    #pragma parseroption -p-
    #define NewLine "\n"
    #pragma parseroption -p+