출처:http://stackoverflow.com/questions/4311995/inno-setup-custom-page
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "DXX-Rebirth"
#define MyAppName1 "D1X-Rebirth"
#define MyAppName2 "D2X-Rebirth"
#define MyAppVersion "0.57.0"
#define MyAppURL "http://www.dxx-rebirth.com/"
#define MyAppExeName "d1x-rebirth.exe"
#define MyAppExeName2 "d2x-rebirth.exe"
[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={{DF665ED8-D2A7-490A-805F-6677EFFBAB40}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=Setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Types]
Name: "install"; Description: "DXX-Rebirth"; Flags: iscustom
[Components]
Name: "d1x"; Description: "D1X-Rebirth"; Types: install
Name: "d2x"; Description: "D2X-Rebirth"; Types: install
[Files]
;D1X Files
[Icons]
[Run]
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[Code]
// global vars
var
SampleDataPage: TInputOptionWizardPage;
DataDirPage: TInputDirWizardPage;
DataDirPage1: TInputDirWizardPage;
DataDirPage2: TInputDirWizardPage;
// custom wizard page setup, for data dir.
procedure InitializeWizard;
begin
{ Taken from CodeDlg.iss example script }
{ Create custom pages to show during install }
SampleDataPage := CreateInputOptionPage(wpSelectComponents,
'Install Descent Data', '',
'Would you like to copy the Descent game files to your DXX-Rebirth installation?',
True, False);
SampleDataPage.Add('Yes copy the game files, missions, players, and savegames.');
SampleDataPage.Add('Yes, but just copy the game files.');
SampleDataPage.Add('No, I'+chr(39)+'ll copy the game files myself later.');
SampleDataPage.Values[0] := True;
DataDirPage := CreateInputDirPage(SampleDataPage.ID,
'Descent Data Directory', '',
'Please select the location where the original Descent files are installed.',
False, '');
DataDirPage.Add('Descent location.');
DataDirPage.Add('Decent 2 location.');
DataDirPage.Values[0] := ExpandConstant('{pf}\GOG.com\Descent and Descent 2\Descent');
DataDirPage.Values[1] := ExpandConstant('{pf}\GOG.com\Descent and Descent 2\Descent 2');
DataDirPage1 := CreateInputDirPage(SampleDataPage.ID,
'Descent Data Directory', '',
'Please select the location where the original Descent files are installed.',
False, '');
DataDirPage1.Add('');
DataDirPage1.Values[0] := ExpandConstant('{pf}\GOG.com\Descent and Descent 2\Descent');
DataDirPage2 := CreateInputDirPage(SampleDataPage.ID,
'Descent Data Directory', '',
'Please select the location where the original Descent 2 files are installed.',
False, '');
DataDirPage2.Add('Decent 2 location.');
DataDirPage2.Values[0] := ExpandConstant('{pf}\GOG.com\Descent and Descent 2\Descent 2');
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if (PageID = DataDirPage.ID) and (SampleDataPage.Values[2] = true) then
begin
Result := True
exit;
end;
if (IsComponentSelected('d1x') = true) and (IsComponentSelected('d2x') = true) then
begin
if PageID = DataDirPage.ID then
begin
result := false;
exit;
end;
if PageID = DataDirPage1.ID then
begin
result := true;
exit;
end;
if PageID = DataDirPage2.ID then
begin
result := true;
exit;
end;
exit;
end;
if (IsComponentSelected('d1x') = true) and (IsComponentSelected('d2x') = false) then
begin
if PageID = DataDirPage.ID then
begin
result := true;
exit;
end;
if PageID = DataDirPage1.ID then
begin
result := false;
exit;
end;
if PageID = DataDirPage2.ID then
begin
result := true;
exit;
end;
exit;
end;
if (IsComponentSelected('d1x') = false) and (IsComponentSelected('d2x') = true) then
begin
if PageID = DataDirPage.ID then
begin
result := true;
exit;
end;
if PageID = DataDirPage1.ID then
begin
result := true;
exit;
end;
if PageID = DataDirPage2.ID then
begin
result := false;
exit;
end;
exit;
end
else
begin
result := false;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpSelectComponents then
begin
if (IsComponentSelected('d1x') = false) and (IsComponentSelected('d2x') = false) then
begin
MsgBox('You didn'+chr(39)+'t select anything to install.', mbError, MB_OK);
result := false;
exit;
end
else
result := true;
end
else
result := true;
end;
function InstallAll(): Boolean;
begin
{ Return the value of the 'install' radiobutton }
//MsgBox('InstallSampleData.', mbError, MB_OK);
Result := SampleDataPage.Values[0];
end;
function Install(): Boolean;
begin
{ Return the value of the 'install' radiobutton }
//MsgBox('InstallSampleData.', mbError, MB_OK);
Result := SampleDataPage.Values[1];
end;
function DontInstall(): Boolean;
begin
Result := SampleDataPage.Values[2];
end;
function DescentTwo(Param: String): String;
begin
if Assigned(DataDirPage) then
begin
if (IsComponentSelected('d1x') = true) and (IsComponentSelected('d2x') = true) then
begin
result := DataDirPage.Values[1];
end;
if (IsComponentSelected('d1x') = false) and (IsComponentSelected('d2x') = true) then
begin
result := DataDirPage.Values[0];
end;
if (IsComponentSelected('d1x') = true) and (IsComponentSelected('d2x') = false) then
begin
result := '';
end;
end
else
result := '';
end;
function Descent(Param: String): String;
begin
if Assigned(DataDirPage) then
begin
if (IsComponentSelected('d1x') = false) and (IsComponentSelected('d2x') = true) then
begin
result := '';
end
else
begin
result := DataDirPage.Values[0];
end;
end
else
result := '';
end;
end.
댓글 없음:
댓글 쓰기