tags:

views:

2620

answers:

2

Alternatively is it possible to manually update the built in progress bar? Basically I have 2 MSIs included and using Inno Setup as a bootstrapper, and depending on user input one or both of the MSIs are to be installed. I have something working using Exec statements in CurStepChanged but it doesn't update the progress bar as the files are extracted and it looks like the installer is stalled. I guess the end result is I want some progress bar updates while the files are extracted to the temp folder. The following is my current code:

procedure CurStepChanged(CurStep: TSetupStep);
var
    ResultCode: Integer;
begin
    if(CurStep = ssInstall) then begin
     if(InstallServer) then begin
      ExtractTemporaryFile('ServerSetup.msi');
      Exec('msiexec',ExpandConstant('/i "{tmp}\ServerSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Server\" ALLUSERS=2'),'', SW_SHOW, ewWaitUntilTerminated, ResultCode);
     end;
     if(InstallClient) then begin
      ExtractTemporaryFile('ClientSetup.msi');
      Exec('msiexec',ExpandConstant('/i "{tmp}\ClientSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Client\" ALLUSERS=2'),'', SW_SHOW, ewWaitUntilTerminated, ResultCode);
     end;
    end;
end;
+7  A: 

Why not simply try something like this:

[Files]
Source: ClientSetup.msi; DestDir: {tmp}; Flags: deleteafterinstall; Components: Client
Source: ServerSetup.msi; DestDir: {tmp}; Flags: deleteafterinstall; Components: Server

[Run]
Filename: msiexec.exe; Parameters: /i "{tmp}\ClientSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Client\" ALLUSERS=2; WorkingDir: {tmp}; StatusMsg: Installing client; Components: Client
Filename: msiexec.exe; Parameters: /i "{tmp}\ServerSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Server\" ALLUSERS=2; WorkingDir: {tmp}; StatusMsg: Installing server; Components: Server

[Components]
Name: Client; Description: Client Installation
Name: Server; Description: Server Installation

Of course you don't necessarily have to use Components. You did not write how you decide which installer to run. If you need more complex logic you could also use Check functions as in:

[Files]
Source: ClientSetup.msi; DestDir: {tmp}; Flags: deleteafterinstall; Check: CheckClient
Source: ServerSetup.msi; DestDir: {tmp}; Flags: deleteafterinstall; Check: CheckServer

[Run]
Filename: msiexec.exe; Parameters: /i "{tmp}\ClientSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Client\" ALLUSERS=2; WorkingDir: {tmp}; StatusMsg: Installing client; Check: CheckClient
Filename: msiexec.exe; Parameters: /i "{tmp}\ServerSetup.msi" /qb INSTALLDIR="{code:GetInstallPath}\Server\" ALLUSERS=2; WorkingDir: {tmp}; StatusMsg: Installing server; Check: CheckServer

[Code]
function CheckClient: Boolean;
begin
  Result := WhateverCondition;
end;

function CheckServer: Boolean;
begin
  Result := WhateverOtherCondition;
end;
Oliver Giesen
I think the Check: is what I needed to know. I didn't see anything about that in the Inno Setup help file (which surprisingly has been fairly helpful) and it wasn't an option in the ISTool gui. +1 now and accepted if it works :)
Davy8
I linked to the relevant help file section in the answer (See the "Check functions"). It is in there. ISTool also supports this. Just look at the "Common" tab of any item in the "Scripting" section. If you already wrote functions with a Boolean result you can simply pick them from a dropdown there.
Oliver Giesen
Yeah, I noticed that after I started doing this. Looks like it works and is as close to ideal as I'm probably gonna get without spending hours/days researching and making a custom progress dialog and stuff. Thanks :)
Davy8
A: 

And if in 'WhateverCondition' I'd like to check if a specific component was chosen to be installed, what would I do?

Sydney
StackOverflow doesn't work this way, please ask a new question instead.
mghie