Inno设置:如何将变量从[代码]传递到[运行](或其他部分)

问题描述 投票:17回答:1

如何在Inno Setup中将[Code]部分中的变量传递给[Run]部分中的参数?

基本上,我想执行以下操作。

  1. 获取用户输入并将其保存到过程InitializeWizard中的变量。]​​>
  2. 将用户输入传递给[Run]部分中的可执行文件
  3. 这是我的代码。

[Run]
Filename: "someProgram.exe"; Parameters: ??userInput??

[Code]
procedure InitializeWizard;
var 
  ConfigPage: TInputQueryWizardPage;
  UserInput: String;
begin
  { Create the page }
  ConfigPage :=
    CreateInputQueryPage(
      wpWelcome, 'User input', 'User input',
      'Please specify the following information, then click Next.');

  { Add items (False means it's not a password edit) }
  ConfigPage.Add('Input here:', False);
  { Set initial values (optional) }
  ConfigPage.Values[0] := ExpandConstant('hello');
  { Read values into variables }
  UserInput := ConfigPage.Values[0];
end;

谢谢。

如何在Inno Setup的[Run]部分将变量从[Code]部分传递给参数?基本上,我想执行以下操作。获取用户输入并将其保存到过程中的变量...

inno-setup pascalscript
1个回答
29
投票

您正在寻找scripted constant。请参见以下示例:

© www.soinside.com 2019 - 2024. All rights reserved.