18

Inno Setup でセクションから[Code]セクションのパラメータに変数を渡すにはどうすればよいですか?[Run]

基本的に、私は次のことをしたいです。

  1. ユーザー入力を取得して、プロシージャ内の変数に保存しますInitializeWizard
  2. [Run]ユーザー入力をセクションの実行可能ファイルに渡します

これが私のコードです。

[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;

ありがとう。

4

1 に答える 1

31

スクリプト定数を探しています。次の例を参照してください。

[Run]
Filename: "SomeProgram.exe"; Parameters: {code:GetParams}

[Code]
var
  ConfigPage: TInputQueryWizardPage;

function GetParams(Value: string): string;
begin
  Result := ConfigPage.Values[0];
end;

procedure InitializeWizard;
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');
end;
于 2013-10-10T15:34:22.987 に答える