ElramV
ElramV

Reputation: 325

use a var in [RUN] section

i wish to read a var value in [RUN] section, kets say this is my code -

[Setup]

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

[Run]
Filename: "{app}\MyProg.exe"; Description: ""; parameters:"/setid=SessionIDValue"

[code]
var

    SessionIDValue: String;

procedure InitializeWizard();

  begin

    SessionIDValue:= 'test';

    end;

Is it possible to pass SessionIDValue value to parameters:"/setid=SessionIDValue"

10X FOR THE HELP

Upvotes: 1

Views: 1185

Answers (1)

TLama
TLama

Reputation: 76733

You can write a scripted {code:...} constant getter function to bridge the [Code] section with scripting sections, e.g.:

[Run]
Filename: "{app}\MyProg.exe"; Parameters: "{code:GetSessionID}"

[Code]
var
  SessionID: string;

function GetSessionID(Param: string): string;
begin
  Result := SessionID;
end;

Upvotes: 2

Related Questions