4

This is what I'm trying to figure out, in Inno Setup I want the installer to get

  1. User's name (manual input)
  2. Birthday (manual input)

And both of those i want to use as variable to save it in registry

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
mike
  • 100
  • 10

1 Answers1

7

Just combine answers to these questions:

They show you how to use the CreateInputQueryPage function and scripted constants to get a code like this:

[Registry]
Root: HKCU; Subkey: "Software\My Company\My Program"; \
    ValueType: string; ValueName: "UserName"; 
    ValueData: "{code:GetUserName}"
Root: HKCU; Subkey: "Software\My Company\My Program"; \
    ValueType: string; ValueName: "UserBirthday"; \
    ValueData: "{code:GetUserBirthday}"
[Code]

var
  UserInputsPage: TInputQueryWizardPage;
  
function GetUserName(Param: string): string;
begin
  Result := UserInputsPage.Values[0];
end;
  
function GetUserBirthday(Param: string): string;
begin
  Result := UserInputsPage.Values[1];
end;

procedure InitializeWizard;
begin
  { Create the page }
  UserInputsPage :=
    CreateInputQueryPage(wpWelcome,
      'User information', 'User name and birthday',
      'Please specify the following information, then click Next.');
  UserInputsPage.Add('Name:', False);
  UserInputsPage.Add('Birthday:', False);
end;

User name and birthday page

This will create a registry key like:

[HKEY_CURRENT_USER\SOFTWARE\My Company\My Program]
"UserName"="John Doe"
"UserBirthday"="1975-05-02"
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992