Prompt for an additional folder for data

From ISXKB

(Difference between revisions)
Jump to: navigation, search
(Prompt for an additional folder for data)
(added category and image)
Line 1: Line 1:
-
{{WIP}}
 
-
 
This script shows how to insert a custom wizard page after the directory page, and prompt for another folder where to install some other files, for example a database.
This script shows how to insert a custom wizard page after the directory page, and prompt for another folder where to install some other files, for example a database.
This script is a small version of a more complex script that shows also many things about custom wizard pages, that script is ScriptDlg.iss and is in Examples folder of your Inno Setup installation folder.
This script is a small version of a more complex script that shows also many things about custom wizard pages, that script is ScriptDlg.iss and is in Examples folder of your Inno Setup installation folder.
-
 
+
[[Image:AddDataDir.png|thumb|200px]]
<pre>
<pre>
[Setup]
[Setup]
Line 72: Line 70:
end;
end;
</pre>
</pre>
 +
 +
[[Category:Wizard and forms]]

Revision as of 22:56, 6 January 2007

This script shows how to insert a custom wizard page after the directory page, and prompt for another folder where to install some other files, for example a database. This script is a small version of a more complex script that shows also many things about custom wizard pages, that script is ScriptDlg.iss and is in Examples folder of your Inno Setup installation folder.

[Setup]
AppName=MyProg
AppVerName=MyProg
DefaultDirName={pf}\MyProg
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\MyProg.exe

[Files]
;Main program that will be installed in {app} folder
Source: MyProg.exe; DestDir: {app}

;Database file that will installed where user choosed
Source: DataBase.mdb; DestDir: {code:GetDataDir}

[Code]
var
  DataDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  // Create the page

  DataDirPage := CreateInputDirPage(wpSelectDir,
    'Select Personal Data Directory', 'Where should personal data files be installed?',
    'Select the folder in which Setup should install personal data files, then click Next.',
    False, '');
  DataDirPage.Add('');

  DataDirPage.Values[0] := GetPreviousData('DataDir', '');
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  // store the folder chosed, for a further reinstall/upgrade
  SetPreviousData(PreviousDataKey, 'DataDir', DataDirPage.Values[0]);
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  // set default folder if empty
  if DataDirPage.Values[0] = '' then
     DataDirPage.Values[0] := ExpandConstant('{sd}\DataDir');
  Result := True;
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  // Fill the 'Ready Memo' with the normal settings and the custom settings
  S := '';

  S := S + MemoDirInfo + NewLine + NewLine;

  S := S + 'Database path' + NewLine;
  S := S + Space + DataDirPage.Values[0] + NewLine;

  Result := S;
end;

function GetDataDir(Param: String): String;
begin
  { Return the selected DataDir }
  Result := DataDirPage.Values[0];
end;
Personal tools
Ads: