Difference between revisions of "Inno Setup Usage"

From Free Pascal wiki
Jump to navigationJump to search
m (Text replace - "delphi>" to "syntaxhighlight>")
(More description of inno, typos/grammar)
Line 1: Line 1:
[[Inno Setup]] ([http://www.jrsoftware.org/isinfo.php home]) is a program to develop installers for Windows. Is coded in Delphi and has unicode support. Is one of the most often used programs to create setup files alongside with nsis. The advantage of Inno Setup is that support Pascal Scripting.
+
Inno Setup ([http://www.jrsoftware.org/isinfo.php home]) is a program that lets you create Windows installers for your programs. It is coded in Delphi and has Unicode support. It is one of the most often used programs to create setup files (alongside with nsis). The advantage of Inno Setup is that it supports Pascal Scripting for more advanced tasks (although the built in capabilities are already very extensive).
 +
 
 +
Like nsis, Inno Setup uses script files (.iss) to indicate what files to install and where. While you can create these with a simple text editor, there are some IDEs for Inno Setup that provide easier editing.
 +
 
 +
Inno Setup comes with extensive help on the syntax of the script file.
 +
 
 +
== Inno Setup for Linux/OSX? ==
 +
Occassionally, on forums and mailing lists, people ask why there is no Inno Setup for OSX or Linux. However, many people agree that you should use the distribution package manager format (e.g. .rpm, .deb) for Linux and the standard OSX way (e.g. .dmg disk images with the Apple-provided tools) for that.
 +
See e.g. [http://www.lazarus.freepascal.org/index.php/topic,14789.msg78576.html this forum discussion] for an example.
  
 
== Download ==
 
== Download ==
 
+
[http://www.jrsoftware.org/isdl.php#qsp Download Inno Setup Quick Start Pack] is the recommended download. It contains Inno Setup, some IDEs and a preprocessor.
[http://www.jrsoftware.org/isdl.php#qsp Download Inno Setup Quick Start Pack] Is the recommended download.
 
  
 
== Examples ==
 
== Examples ==
 +
* The Lazarus setup for Windows was created with Inno Setup. This script includes PascalScript sections used to customize the installer, which may serve as inspiration for your own installers. You can download the latest version of the install script here: [http://lazarus.svn.sourceforge.net/viewvc/lazarus/trunk/tools/install/win/lazarus.iss?view=log lazarus.iss]
  
* The Lazarus setup for Windows was created with Inno Setup, you can download the latest snapshot here: [http://lazarus.svn.sourceforge.net/viewvc/lazarus/trunk/tools/install/win/lazarus.iss?view=log lazarus.iss]
+
* [[LazPaint]] setup was also created with it: [http://lazpaint.svn.sourceforge.net/viewvc/lazpaint/lazpaint/lazpaint.iss?view=log lazpaint.iss]
  
* Also [[LazPaint]] setup was created with it: [http://lazpaint.svn.sourceforge.net/viewvc/lazpaint/lazpaint/lazpaint.iss?view=log lazpaint.iss]
+
Both scripts have File Association support and are listed in Default Programs to restore the file associations if needed (Windows 7).
  
Both scripts has File Association support and are listed in Default Programs to restore the file associations if needed (Windows 7).
+
Below we show some example of Inno Setup usage. Please have a look at their extensive help files and web site for information on how to perform other tasks.
  
 
== File Association ==
 
== File Association ==
Line 17: Line 25:
 
The file association code is in the [Registry] section of the script.
 
The file association code is in the [Registry] section of the script.
  
The first thing we need is each type of association. In this case is for .bmp files. You can see the first line is for the description of the association 'Bitmap'. The second line is the icon for .bmp files in the explorer, the third is the icon for the right clic menu on .bmp files in the explorer, the last is the parameter to open the file.
+
The first thing we need is each type of association. In the example below, the type is for .bmp files. You can see the first line is for the description of the association 'Bitmap'. The second line is the icon for .bmp files in the explorer, the third is the icon for the right clic menu on .bmp files in the explorer, the last is the parameter to open the file.
  
<syntaxhighlight>[Registry]
+
<syntaxhighlight lang="reg">[Registry]
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp"; ValueType: String; ValueData: "Bitmap"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp"; ValueType: String; ValueData: "Bitmap"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\DefaultIcon"; ValueType: String; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\DefaultIcon"; ValueType: String; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletekey
Line 25: Line 33:
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\Shell\Open\Command"; ValueType: String; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey</syntaxhighlight>
 
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\Shell\Open\Command"; ValueType: String; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey</syntaxhighlight>
  
That code doesn't associate nothing, the next code is to associate our type 'LazPaint.AssocFile.bmp' with '.bmp'. It is only executed when the task assoc_bmp is selected. Read about tasks in the Inno Setup help.
+
That code doesn't associate anything, the following code is to associate our type 'LazPaint.AssocFile.bmp' with '.bmp'. It is only executed when the task assoc_bmp is selected. Read about tasks in the Inno Setup help.
  
<syntaxhighlight>Root: HKLM; Subkey: "Software\Classes\.bmp"; ValueType: String; ValueData: "LazPaint.AssocFile.bmp"; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: assoc_bmp</syntaxhighlight>
+
<syntaxhighlight lang="reg">Root: HKLM; Subkey: "Software\Classes\.bmp"; ValueType: String; ValueData: "LazPaint.AssocFile.bmp"; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: assoc_bmp</syntaxhighlight>
  
That's all. Now we have associated .bmp with LazPaint.
+
That's all. Now we have associated .bmp with our program (LazPaint in the example).
  
 
== Default Programs ==
 
== Default Programs ==
  
Default Programs is used to list the applications that has file association support. Values are the name of the app, a short description and each one of the extensions the program has support.
+
Default Programs is used to list the applications that have file association support. Values are the name of the app, a short description and each one of the extensions the program has support.
  
<syntaxhighlight>Root: HKLM; Subkey: "Software\LazPaint"; Flags: uninsdeletekey
+
<syntaxhighlight lang="reg">Root: HKLM; Subkey: "Software\LazPaint"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationName"; ValueData: "LazPaint"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationName"; ValueData: "LazPaint"; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationDescription"; ValueData: "A short description..."; Flags: uninsdeletekey
 
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationDescription"; ValueData: "A short description..."; Flags: uninsdeletekey

Revision as of 10:08, 2 August 2012

Inno Setup (home) is a program that lets you create Windows installers for your programs. It is coded in Delphi and has Unicode support. It is one of the most often used programs to create setup files (alongside with nsis). The advantage of Inno Setup is that it supports Pascal Scripting for more advanced tasks (although the built in capabilities are already very extensive).

Like nsis, Inno Setup uses script files (.iss) to indicate what files to install and where. While you can create these with a simple text editor, there are some IDEs for Inno Setup that provide easier editing.

Inno Setup comes with extensive help on the syntax of the script file.

Inno Setup for Linux/OSX?

Occassionally, on forums and mailing lists, people ask why there is no Inno Setup for OSX or Linux. However, many people agree that you should use the distribution package manager format (e.g. .rpm, .deb) for Linux and the standard OSX way (e.g. .dmg disk images with the Apple-provided tools) for that. See e.g. this forum discussion for an example.

Download

Download Inno Setup Quick Start Pack is the recommended download. It contains Inno Setup, some IDEs and a preprocessor.

Examples

  • The Lazarus setup for Windows was created with Inno Setup. This script includes PascalScript sections used to customize the installer, which may serve as inspiration for your own installers. You can download the latest version of the install script here: lazarus.iss

Both scripts have File Association support and are listed in Default Programs to restore the file associations if needed (Windows 7).

Below we show some example of Inno Setup usage. Please have a look at their extensive help files and web site for information on how to perform other tasks.

File Association

The file association code is in the [Registry] section of the script.

The first thing we need is each type of association. In the example below, the type is for .bmp files. You can see the first line is for the description of the association 'Bitmap'. The second line is the icon for .bmp files in the explorer, the third is the icon for the right clic menu on .bmp files in the explorer, the last is the parameter to open the file.

[Registry]
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp"; ValueType: String; ValueData: "Bitmap"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\DefaultIcon"; ValueType: String; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\Shell\Open"; ValueName: Icon; ValueType: String; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\Classes\LazPaint.AssocFile.bmp\Shell\Open\Command"; ValueType: String; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey

That code doesn't associate anything, the following code is to associate our type 'LazPaint.AssocFile.bmp' with '.bmp'. It is only executed when the task assoc_bmp is selected. Read about tasks in the Inno Setup help.

Root: HKLM; Subkey: "Software\Classes\.bmp"; ValueType: String; ValueData: "LazPaint.AssocFile.bmp"; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: assoc_bmp

That's all. Now we have associated .bmp with our program (LazPaint in the example).

Default Programs

Default Programs is used to list the applications that have file association support. Values are the name of the app, a short description and each one of the extensions the program has support.

Root: HKLM; Subkey: "Software\LazPaint"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationName"; ValueData: "LazPaint"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\LazPaint\Capabilities"; ValueType: String; ValueName: "ApplicationDescription"; ValueData: "A short description..."; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\LazPaint\Capabilities\FileAssociations"; ValueName: ".bmp"; ValueType: String; ValueData: "LazPaint.AssocFile.bmp"; Flags: uninsdeletekey

Finally we need to add the program to the 'Registered Applications':

Root: HKLM; Subkey: "Software\RegisteredApplications"; ValueType: String; ValueName: "LazPaint"; ValueData: "Software\LazPaint\Capabilities"; Flags: uninsdeletevalue uninsdeletekeyifempty