4

InnoSetup(「IconMain.ico」を使用)で生成された単一の実行可能ファイルと単一のアンインストール(別のアイコン「IconUninst.ico」を使用)で、ドライブ「C」と「K」にいくつかのファイルをインストールしたいと思います。次のように、ユーザーはドライブのパス/名前を変更できません。

STANDART RADIOBUTTON - 
Full installation. Files that will be installed in drive "C:" AND "K:"

- Game.exe     --> DRIVE C:\games
- Mapping.exe  --> DRIVE C:\Mapping
- Pics.dll     --> DRIVE C:\Pics 
- AAA.dll      --> DRIVE K:\Sounds
- BBB.obj      --> DRIVE K:\Sounds

'

ADVANCED RADIONBUTTON -
Partial installation. 
The only files that will be installed. (IF user agrees to continue)

- AAA.dll      --> DRIVE K:\Sounds
- BBB.obj      --> DRIVE K:\Sounds

どうすればそれを達成できますか? ありがとうございました !

4

2 に答える 2

11

特定のファイルを条件付きでインストールするには、パラメーターを使用する必要がありCheckます。アイテムをインストールするには、式または関数にTrueを返す必要があり、スキップするにはFalseを返す必要があります。前の割り当ての例は、前の文でリンクしたリファレンスページに示されています。

したがって、これを前述のように組み合わせるにcustom installation type radio buttonsは、チェックに割り当てられ、選択したラジオボタンに応じて結果を返す関数を作成する必要があります。

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
; these two items will be installed always
Source: "AAA.dll"; DestDir: "K:\Sounds"
Source: "BBB.obj"; DestDir: "K:\Sounds"
; these three items will be installed only when the IsFullInstallation
; function returns True, what will depend on the selected radio button
Source: "Game.exe"; DestDir: "C:\Games"; Check: IsFullInstallation;
Source: "Mapping.exe"; DestDir: "C:\Mapping"; Check: IsFullInstallation;
Source: "Pics.dll"; DestDir: "C:\Pics"; Check: IsFullInstallation;

[Code]    
const
  FullDescText =
    'Full installation. Files will be installed on drives "C:" and "K:"';
  PartDescText =
    'Partial installation. Files will be installed on drives "C:" and "K:"';

var
  FullRadioButton: TNewRadioButton;
  PartRadioButton: TNewRadioButton;

procedure InitializeWizard;
var
  CustomPage: TWizardPage;
  FullDescLabel: TLabel;
  PartDescLabel: TLabel;
begin
  CustomPage := CreateCustomPage(wpWelcome, 'Installation type', '');
  FullRadioButton := TNewRadioButton.Create(WizardForm);
  FullRadioButton.Parent := CustomPage.Surface;
  FullRadioButton.Checked := True;
  FullRadioButton.Top := 16;
  FullRadioButton.Width := CustomPage.SurfaceWidth;
  FullRadioButton.Font.Style := [fsBold];
  FullRadioButton.Font.Size := 9;
  FullRadioButton.Caption := 'Full Installation'
  FullDescLabel := TLabel.Create(WizardForm);
  FullDescLabel.Parent := CustomPage.Surface;
  FullDescLabel.Left := 8;
  FullDescLabel.Top := FullRadioButton.Top + FullRadioButton.Height + 8;
  FullDescLabel.Width := CustomPage.SurfaceWidth; 
  FullDescLabel.Height := 40;
  FullDescLabel.AutoSize := False;
  FullDescLabel.Wordwrap := True;
  FullDescLabel.Caption := FullDescText;
  PartRadioButton := TNewRadioButton.Create(WizardForm);
  PartRadioButton.Parent := CustomPage.Surface;
  PartRadioButton.Top := FullDescLabel.Top + FullDescLabel.Height + 16;
  PartRadioButton.Width := CustomPage.SurfaceWidth;
  PartRadioButton.Font.Style := [fsBold];
  PartRadioButton.Font.Size := 9;
  PartRadioButton.Caption := 'Partial Installation'
  PartDescLabel := TLabel.Create(WizardForm);
  PartDescLabel.Parent := CustomPage.Surface;
  PartDescLabel.Left := 8;
  PartDescLabel.Top := PartRadioButton.Top + PartRadioButton.Height + 8;
  PartDescLabel.Width := CustomPage.SurfaceWidth;
  PartDescLabel.Height := 40;
  PartDescLabel.AutoSize := False;
  PartDescLabel.Wordwrap := True;
  PartDescLabel.Caption := PartDescText;
end;

function IsFullInstallation: Boolean;
begin
  Result := FullRadioButton.Checked;
end;
于 2012-09-08T19:37:53.713 に答える
5

条件付きインストールを行う最も簡単な方法は、とを使用すること[Types]です[Components]

[Types]
Name: standard; Description: Standard
Name: partial; Description: Partial

[Components]
Name: game; Description: Full game install; Types: standard
Name: sounds; Description: Sound files; Types: standard partial

[Files]
...; Components: game
...; Components: sounds
于 2012-09-08T21:47:20.487 に答える