The Pascal scripting feature (modern Delphi-like Pascal) adds lots of new possibilities to customize your Setup or Uninstall at run-time. Some examples:
- Support for aborting Setup or Uninstall startup under custom conditions.
- Support for adding custom wizard pages to Setup at run-time.
- Support for extracting and calling DLL or other files from the Pascal script before, during or after the installation.
- Support for scripted constants that can do anything the normal constants, the read-from-registry, read-from-ini and read-from-commandline constants can do + more.
- Support for run-time removal of types, components and/or tasks under custom conditions.
- Support for conditional installation of [Files], [Registry], [Run] etc. entries based on custom conditions.
- Lots of support functions to do from the Pascal script just about everything Inno Setup itself does/can do + more.
An integrated run-time debugger to debug your custom Pascal script is also available.
The scripting engine used by Inno Setup is RemObjects Pascal Script by Carlo Kok. Like Inno Setup, RemObjects Pascal Script is freely available and comes with source. See http://www.remobjects.com/ps
for more information.
Note: the Pascal scripting feature works exclusively at run-time, and has no compile-time functionality.
Language differences compared to Delphi
Pascal Script has some language differences compared to Delphi. Key differences include:
- No inline var or inline const. All local variables must be declared in a var block before begin.
- No local const or type declarations. Only var and label blocks are allowed before begin.
- No Exit(Value) syntax. Assign to Result first, then call Exit separately.
- No typed constants (const X: Integer = 1). Only untyped constants (const X = 1).
- No default parameter values.
- No function or procedure overloading.
- No raise keyword. Use RaiseException(Msg) or RaiseLastException instead.
- No on E: ExceptionType do in except blocks. Use GetExceptionMessage to inspect the current exception.
- No script-defined classes. Classes can be used, but only those defined by Inno Setup.
- No variant records.
- const parameters are passed by value (copied), and not by reference as in modern Delphi.
- The / operator always returns Extended, even when both operands are integers. Use div for integer division.
- Break and Continue are not reserved words. They are ordinary identifiers recognized specially inside loop bodies. A local declaration named Break or Continue will shadow the loop-control behavior.
- Low, High, and SizeOf must be used with a variable, not a type.
See also:
Creating the [Code] section
Event Functions
Scripted Constants
Check Parameters
BeforeInstall and AfterInstall Parameters
Uninstall Code
Examples
Support Functions Reference
Support Classes Reference
Using Custom Wizard Pages
Using DLL files
Using COM Automation objects
Run-time debugger