如何要求用户指定文件夹名称(使用Inno Setup)? [英] How to ask the user to specify a folder name (using Inno Setup)?

查看:135
本文介绍了如何要求用户指定文件夹名称(使用Inno Setup)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须安装依赖于Web服务器(XAMPP)的应用程序,因此我想向安装向导中添加一个表单,该表单会通知用户(如果XAMPP的给定文件夹不存在),然后提供一个文本框,并要求用户指定此Web服务器的安装文件夹名称.

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.

你能指导我怎么做吗?

谢谢

推荐答案

使用 CreateInputDirPage函数创建页面/表单.

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;

您应该添加一些验证.

另请参阅文章 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆