jrsoftware.org // Jordan Russell's Software
-Home

Products

-Inno Setup


-Toolbar2000

-Toolbar97

-StripReloc

-More...

Support

-Newsgroups

-Contact Me

#######
visitors since
Jan. 1998

Inno Setup Knowledge Base
Return to index

HOWTO: Implement Custom Functionality

Article Created: 2003-10-22 08:37 GMT by Jordan Russell
Last Updated: 2003-10-24 04:21 GMT by Jordan Russell


If your installation requires customized functionality beyond what Inno Setup currently offers (such as modifying AUTOEXEC.BAT, registering database aliases, or registering an NT service), you have three options:

Pascal Scripting

Inno Setup 4 introduces the Pascal Scripting feature. See the "Pascal Scripting" section of the documentation for details on the new possibilities it opens up and usage information.

The [Run] Section

This is an oft overlooked yet simple method of performing custom installation tasks. First, write a small program in the development tool of your choice (preferably one that creates stand-alone EXEs, such as Delphi) that performs the desired task, and copy its EXE to your script directory. Next, place an entry in the [Files] script section telling Setup to copy the EXE to the install's temporary directory ("{tmp}"):

[Files]
Source: "ModifyAutoexec.exe"; DestDir: "{tmp}"

Then add a [Run] section entry, telling Setup to execute the EXE after all other installation steps:

[Run]
Filename: "{tmp}\ModifyAutoexec.exe"

If the program needs additional information, such as the value of the "{app}" constant, you could pass it via a command line parameter, i.e.:

[Run]
Filename: "{tmp}\ModifyAutoexec.exe"; Parameters: """{app}"""

To save some bytes, you could alternatively incorporate the installation task into your application's main EXE and have it perform the task when called with a special command line parameter. For example:

[Run]
Filename: "{app}\MyProgram.exe"; Parameters: "/DoTheTask"

Modifying the Inno Setup Source Code

This should be considered a "last resort", as implementing changes in the Inno Setup source code makes it difficult to upgrade to new Inno Setup versions as they are released. But if fundamental changes to the behavior of the Setup program are required, this may be necessary.


Site contents Copyright © 1997-2012 Jordan Russell. All rights reserved.