Recently one of our customers found that they had a large number of InnoSetup installer scripts in which great swathes of the content were identical. As a result if there was a change to the base script, all the scripts had to be individually modified in exactly the same way, potentially leading to human error caused by copy and paste or typing errors, and even missing a change in one or more of the files.

In many cases, the only difference between the scripts were a number of additional files that needed to be referenced in the file section. How could this problem be addressed to remove the need to change the base script manually, and remove the increased risk of human error?

The existing scripts were already being processed by Pipeline Runner, so it seemed sensible to extend the Mod and AssignMod commands to allow new command line flags:

  • /FromFile: If this switch is set and the content of the ReplacementText parameter is a fully qualified path and file name to a text file, the content of that file will be used as the replacement text.
  • /InsertAfter: If this switch is set the ReplacementText will be inserted immediately after the located text rather than replacing the existing text or line.
  • /InsertBefore: If this switch is set the ReplacementText will be inserted immediately before the located text rather than replacing the existing text or line.

For example, this command:

Mod:”[Dirs]”,”C:\My Script Snippet.txt”,/FromFile /InsertBefore

When you run the ModifyFile command this would insert a chunk of text contained in a text file just before the Dirs section of an InnoSetup script.

Now a single base script and a set of snippets can be used to automatically generate the individual InnoSetup scripts that are needed as part of running the main release script.

Of course, this does not apply just to InnoSetup scripts, or even just to scripts. It can be used with any text based file that may need to be modified. Can you think of ways to make it work for you?

This functionality is available in build 1.0.0.80 and higher.

Responsive site designed and developed by