Home > Programming > Another Inno Setup Example

Another Inno Setup Example

I realize no one will be able to copy and paste this script to do exactly what they want, but I thought several of these items might be useful.

I developed another Inno Setup script that copies all files from a file share locally, runs a few installers (from a nested “Installers” directory that houses all the exe’s as you’ll see), sets some registry settings for an ODBC connection to a DBISAM database, and copies the .NET trust settings from a nested “Net Framework” folder, which allows me to set a “Full Trust” as needed for several applications. This setup essentially lets me put the “Net Framework” and an “Installers” folder on a disc with the EXE that this script generates, creating an easy to use install disc for setting up new workstations.

Here is the code, I hope someone finds a useful snippet or two:

#define MyAppName "Software"
#define MyAppVerName "Software Installation 2.0"
#define MyAppPublisher "My Company"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{4D2577F9-92D0-4E6F-83DB-D4009B55C678}
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\Company Programs
DisableDirPage=yes
DefaultGroupName=Company Programs
DisableProgramGroupPage=yes
OutputBaseFilename=Setup
SetupIconFile=Company_Icon.ico
Compression=lzma
SolidCompression=true
Uninstallable=false

[Files]
; Copy all the Company Programs files shared directory
Source: O:\Company Programs\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs uninsremovereadonly
; Copy the "FullTrust" needed for the .NET Framework
Source: NET Framework\v1.1.4322\*; DestDir: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG; Flags: ignoreversion recursesubdirs createallsubdirs uninsremovereadonly

[Run]
; Run all our installers (network drives, printers, DBISAM, Winzip, .NET Framework and the Service Pack) from the nested /Installers directory
Filename: {src}\Installers\MapDrives.bat; WorkingDir: {src}; StatusMsg: Mapping Network Drives
Filename: {src}\Installers\MapPrinters.bat; WorkingDir: {src}; StatusMsg: Mapping Network Printers
Filename: {src}\dbisam\424b1dbisamodbcstd.exe; WorkingDir: {src}; StatusMsg: Installing DBISAM
Filename: {src}\Installers\winzip81.exe; WorkingDir: {src}; StatusMsg: Installing WinZip
Filename: {src}\Installers\dotnetfx.exe; WorkingDir: {src}; StatusMsg: Installing .NET Framework
Filename: {src}\Installers\NDP1.1sp1-KB867460-X86.exe; WorkingDir: {src}; StatusMsg: Installing .NET Framework Update

[Registry]
; Create registry keys for ODBC connections for the database
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM 4 Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: PrivateDirectory; ValueType: string; ValueData: C:\Temp
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\ODBC Data Sources; ValueType: string; ValueName: DBISAM Local Tables; ValueData: DBISAM 4 ODBC Driver; Flags: createvalueifdoesntexist uninsdeletevalue
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Driver; ValueType: string; ValueData: C:\WINDOWS\system32\dbodbc.dll
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: ConnectionType; ValueType: string; ValueData: Local
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemoteHostName; ValueType: string; ValueData:
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemoteIPAddress; ValueType: string; ValueData: 127.0.0.1
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemotePort; ValueType: string; ValueData: 12005
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemoteService; ValueType: string; ValueData:
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemoteCompression; ValueType: string; ValueData: 0
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: UID; ValueType: string; ValueData:
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: PWD; ValueType: string; ValueData:
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: RemoteReadAhead; ValueType: string; ValueData: 50
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: MRUDatabase1; ValueType: string; ValueData: Memory
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: MRUDatabase2; ValueType: string; ValueData: C:\DB_Config\Tables
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: CatalogName; ValueType: string; ValueData: C:\DBL_Config\Tables
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: ReadOnly; ValueType: string; ValueData: False
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: LockRetryCount; ValueType: string; ValueData: 15
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: LockWaitTime; ValueType: string; ValueData: 100
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: ForceBufferFlush; ValueType: string; ValueData: False
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: StrictChangeDetection; ValueType: string; ValueData: False
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: MRUPrivateDirectory1; ValueType: string; ValueData: C:\DOCUME~1\MyUserName\LOCALS~1\Temp\
Root: HKLM; SubKey: Software\ODBC\ODBC.INI\DBISAM Local Tables; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: PrivateDirectory; ValueType: string; ValueData: C:\DOCUME~1\MyUserName\LOCALS~1\Temp\
Categories: Programming Tags:
  1. No comments yet.
  1. No trackbacks yet.