In Inno Setup is it possible to add conditional statements to what in the [Run] section gets executed?

后端 未结 1 554
悲哀的现实
悲哀的现实 2020-12-30 10:02

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 inp

相关标签:
1条回答
  • 2020-12-30 10:31

    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;
    
    0 讨论(0)
提交回复
热议问题