Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ask the user to specify a folder name (using Inno Setup)?

Tags:

inno-setup

I have to install an application that relies on a web server (XAMPP), so I'd like to add to my setup wizard a form that notifies the user if a given folder (of XAMPP) does not exist, then to provide a textbox and to ask the user to specify a folder name where this web server is installed.

I'd like to keep this folder name as a variable, since later I have to place some files in that folder.

Can you guide me how to do so?

Thank you

like image 629
user1918255 Avatar asked Oct 21 '25 06:10

user1918255


1 Answers

Use the CreateInputDirPage function to create the page/form.

Use a scripted constant to install the files to the selected folder.

[Files]
Source: "somefile.txt"; DestDir: "{code:GetOtherDir}"

[Code]

var
  OtherInputDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  OtherInputDirPage :=
    CreateInputDirPage(wpSelectDir, 'Select xampp directory', '', '', False, '');
  OtherInputDirPage.Add('');
end;

function GetOtherDir(Param: String): String;
begin
  Result := OtherInputDirPage.Values[0];
end;

You should add some validation.

See also the article Prompt for an additional folder for data on ISXKB.

like image 91
Martin Prikryl Avatar answered Oct 23 '25 00:10

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!