Sample Inno Setup Script for installing a user module

Brandon Staggs

Administrator
Staff member
Messages
5,680
Attached is a sample Inno Setup script that installs a user module into the user's SwordSearcher User Module folder, and also adds the appropriate uninstall item to the Add/Remove Programs list.

The script file is commented, so please read it completely before using the script. You will need to change some parts of it for your own project(s).
 

Attachments

  • SampleSS5-UserModInstall.zip
    1.4 KB · Views: 410
Thanks for the script and the link to the Inno software. I modified the script to install the Atlas module with graphic files going to the SS images location and the ssbook going to the SS user location. Good stuff.
 
Thanks for the script and the link to the Inno software. I modified the script to install the Atlas module with graphic files going to the SS images location and the ssbook going to the SS user location. Good stuff.

Thanks for all the work you do in adding mods.
 
In the script how do you know what location the user has installed Swordsearcher and where the images are located?

I used DestDir: {pf}\swordsearcher 5\images\atlas\; but that only works for a standard installation.
 
In the script how do you know what location the user has installed Swordsearcher and where the images are located?

I used DestDir: {pf}\swordsearcher 5\images\atlas\; but that only works for a standard installation.

You can change it so that instead of it installing to the user module folder, it asks where SwordSearcher is. You can also have it to a test to make sure that SwordSearcher is actually there.

Code:
[Setup]
; tells the installer to default to the standard SS install folder
DefaultDirName={pf}\SwordSearcher 5
 
[Message]
SelectDirLabel3=Please specify your SwordSearcher folder. This folder must already exist on your computer.
 
[Files]
Source: C:\temp\MyModule.ss5book; DestDir: {app}\Modules; Flags: ignoreversion confirmoverwrite
 
[noparse][code][/noparse]
 
; Makes sure the seleted {app} folder actually has SwordSearcher
function NextButtonClick(CurPageID: Integer): Boolean;
var
fn : String;
begin
Result := True;
if CurPageID = wpSelectDir then
begin
fn := ExpandConstant('{app}\SwordSearcher5.exe');
if not FileExists(fn) then
begin
MsgBox('The selected installation folder does not contain an installation of SwordSearcher 5.' + #10 +
'Please specify your current SwordSearcher 5 installation folder.' + #10#10 +
'If you do not have SwordSearcher 5 installed, please cancel this installation, then install SwordSearcher 5, and finally run this installer again.' + #10#10 +
'(File not found: ' + fn + ')',
mbError, MB_OK);
Result := False;
end;
end;
end;
 
Thanks for the script.

I noticed that the Windows registry has the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SwordSearcher_5_InnoSetup_is1

It's value is the location of the SS install directory. I'm not sure how to make use of it in the script however.

I also realized that I have to put the graphic files in a fixed location since I hard wired them into the atlas so the <img src ...> would work. If someone wants them in a different location, they have to export and modify the atlas.ssbook.
 
I noticed that the Windows registry has the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SwordSearcher_5_InnoSetup_is1

It's value is the location of the SS install directory. I'm not sure how to make use of it in the script however.

I wouldn't rely on that value -- key name is not guaranteed to be consistent. But you could use it to set the default value of the installation folder if it's there, as long as you give the user an opportunity to change it. You'd need to look into the [registry] options for Inno Setup if you want to figure out how to pull the value from the key. I don't have an example for that right now.
 
Back
Top