当前位置: 动力学知识库 > 问答 > 编程问答 >

How to ask the user to specify a folder name (using 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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: