Jammer
Jammer

Reputation: 45

Make Inno Setup automatically add data from custom pages to .inf file

I created a installer with custom wizard pages. All works fine so far. Next I wanted to create a settings file using /SAVEINF (to start the installer later on in silent mode) using the following command:

Installer.exe /SAVEINF="Unattended.txt"

After entering all user input and running the installer, I looked at the file created. The only user input I see is the installation location but missing all my input on the custom wizard pages. All I see is:

[Setup]
Lang=en
Dir=C:\temp
Group=MyProgram
NoIcons=0
Tasks=

Why? What do I need to do to have the custom wizard page values also in the settings file?


To be more specific.
I start the installer I've created with option to create a settings file using the /SAVEINF option on the commandline. I expected all items to be added to this file including the one from my custom wizard pages, but that's not the case. I only see the installation location from the standard setup page.

Of course I can add them manually and implement in the installer code to read them from the file, but I expected it to be automated.

Upvotes: 3

Views: 2822

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202282

Indeed, Inno Setup won't save any custom fields to the .inf file.

It will never save anything to the .inf file beyond the standard Lang, Dir, Group, NoIcons, SetupType, Components and Tasks items.

See SaveInf function in Inno Setup source code:

procedure SaveInf(const FileName: String);
const
  Section = 'Setup';
begin
  SetIniString(Section, 'Lang',
    PSetupLanguageEntry(Entries[seLanguage][ActiveLanguage]).Name, FileName);
  SetIniString(Section, 'Dir', WizardDirValue, FileName);
  SetIniString(Section, 'Group', WizardGroupValue, FileName);
  SetIniBool(Section, 'NoIcons', WizardNoIcons, FileName);
  if WizardSetupType <> nil then begin
    SetIniString(Section, 'SetupType', WizardSetupType.Name, FileName);
    SetIniString(Section, 'Components', StringsToCommaString(WizardComponents), FileName);
  end
  else begin
    DeleteIniEntry(Section, 'SetupType', FileName);
    DeleteIniEntry(Section, 'Components', FileName);
  end;
  SetIniString(Section, 'Tasks', StringsToCommaString(WizardTasks), FileName);
end;

There are more items Inno Setup will load from the .inf file. See the LoadInf function. But again, not custom fields/pages. Just options that can otherwise be specified using command-line switches, like Silent, VerySilent, NoRestart, etc.


If you want custom fields in the .inf file, you have to implement them on your own:
Inno Setup Load defaults for custom installation settings from a file (.inf) for silent installation.

Upvotes: 1

Related Questions