How can I pass a variable from [Code]
section to parameters in [Run]
section in Inno Setup?
Basically, I want to do the following.
InitializeWizard
.[Run]
sectionHere is my code.
[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;
Thanks.
You're looking for the scripted constant. See the following example:
[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;