Innoscript example of user/password input during install

Innoscript

[Setup]
AppId={{DD309715-FAE6-447D-B279-8F2E7E1E9471}
AppName="TEST"
AppVersion="1.0.0"
DefaultDirName=c:\myfolder

[Run]
Filename: "{sys}\WindowsPowerShell\v1.0\powershell"; Parameters: """myscript.ps1"" {code:GetUserName}"

[Code]
var
  Page: TInputQueryWizardPage;
  UserName, Password: String;

function GetUserName(Value: string): string;
begin
  Result := Username;
end;

procedure InitializeWizard();
begin
// Create the page
Page := CreateInputQueryPage(wpWelcome,
  'Web application credentials', '',
  'Please specify web application user and password');

// Add items (False means it's not a password edit)
Page.Add('&Username:', False);
Page.Add('&Password:', True);

// Set initial values (optional)
Page.Values[0] := 'appuser';
Page.Values[1] := 'password';
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then begin
      // Read values into variables
    UserName := Page.Values[0];
    Password := Page.Values[1];
  end;
end;

Post a Comment

Previous Post Next Post