Inno Setup Prompt用户输入文件夹并存储值 [英] Inno Setup Prompt user for a folder and store the value

查看:287
本文介绍了Inno Setup Prompt用户输入文件夹并存储值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下需求:

[Run] 
;run robocopy.exe source dest/OLD/[source_contents] /options

其中:
用户必须在目标计算机上指定(可以根据物理平台进行更改)
目标将与用户定义的源文件夹相同,而子路径OLD/[source_contents]将由robocopy输入自动创建.

Where:
source must be specified by user on the destination machine (this can change according the physical platform)
destination will be identical to the just user-defined source folder while the subpath OLD/[source_contents] will be automatically created by the robocopy input.

我当时想使用脚本常量",但是问题是我需要以某种方式在某些地方存储源"提示参数(我不能在同一位置要求两个提示).

I was thinking to use a "scripted-constant", but the problem is that I need to store some way the "source" prompted parameter some where (I cannot require two prompts for the same place).

谢谢.

推荐答案

脚本常量是一种方法.您只需要确保只提示用户一次,然后将结果重用于源和目标路径即可.

The scripted constant is a way to go. You just need to make sure you prompt the user just once and reuse the results for both the source an the destination path.

例如,您可以使用 CreateInputDirPage 并实现脚本化常量引用用户在页面上指定的路径:

You can for example use CreateInputDirPage and implement the scripted constant to refer to a path that a user specified on the page:

[Run]
Filename: "robocopy.exe"; Parameters: "{code:CopyDir} {code:CopyDir}\OLD"

[Code]
var
  CopyDirPage: TInputDirWizardPage;

procedure InitializeWizard();
begin
  CopyDirPage :=
    CreateInputDirPage(wpSelectDir, 'Select source directory', '',  '', False, '');
  CopyDirPage.Add('Source directory:');
end;

function CopyDir(Params: string): string;
begin
  Result := CopyDirPage.Values[0];
end;

这篇关于Inno Setup Prompt用户输入文件夹并存储值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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