I am having some problem to understand how to use Inno Setup. I created this script to install my app:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "MyApp"
#define MyAppVersion "1.0"
#define MyAppPublisher "Myself"
#define MyAppExeName "MyApp.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{5FA0A2CF-7FD4-4464-AF88-4B73D0857D03}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\{#MyAppName}
DisableDirPage=no
DefaultGroupName=MyApp
;DisableProgramGroupPage=yes
OutputDir=D:\test
OutputBaseFilename=MyApp
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest
UninstallDisplayName=MyApp {#MyAppName}
SetupIconFile="D:\MyApp\MyApp.ico"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "D:\MyApp\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\MyApp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[CustomMessages]
FileTemplateDescription=Test description
[Code]
var
DataDirPage: TInputDirWizardPage;
FileTemplatePage: TInputQueryWizardPage;
CustomStatusLabel: TNewStaticText;
procedure InitializeWizard;
begin
{ This part creates the page where to choose the data location directory }
DataDirPage := CreateInputDirPage(wpSelectDir,
'Select data directory', 'Where are the files you want to use?',
'Select the folder where the data files are located, then click Next.',
False, '');
DataDirPage.Add('');
DataDirPage.Values[0] := GetPreviousData('DataDir', '');
{ This part creates the page where to add the filetemplate }
FileTemplatePage := CreateInputQueryPage(DataDirPage.ID,
'File template', 'This is an advance option, do not change it if you are not sure.',
'Please specify the file template, then click Next.');
// Add items (False means it's not a password edit)
FileTemplatePage.Add('File template:', False);
// Set initial values (optional)
FileTemplatePage.Values[0] := 'GlobalStatReanalysis_temp_sal_ssh_u_v_{{dateTime:%Y%m%d}.nc';
// Description of the file template
// FileTemplatePage.Description := 'Test of description.';
{ S := CustomMessage('FileTemplateDescription');}
CustomStatusLabel := TNewStaticText.Create(WizardForm);
CustomStatusLabel.Parent := WizardForm.InstallingPage;
CustomStatusLabel.Caption := 'Test Text';
end;
//procedure CurPageChanged(CurPageID: Integer);
//begin
// M:= TLabel.Create(WizardForm);
//M.Caption:= (ExpandConstant('{cm:FileTemplateDescription}'));
//end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := DataDirPage.Values[0];
end;
function GetFileTemplate(Param: String): String;
begin
// Return values into variables
Result := FileTemplatePage.Values[0];
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\MyApp.ico"; Parameters: "--path:{code:GetDataDir} --filetemplate:{code:GetFileTemplate} --fileconfig:""{app}\conf.yml"""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent; Parameters: "--path:{code:GetFileTemplate} --filetemplate:{code:GetDataDir} --fileconfig:""{app}\conf.yml"""
I created the page FileTemplatePage
so the user can add a file template.
What I want is to add a description to this page.
Looking around I found this other question. Basically this is exactly what I want, but I really don't get how the script works.
If I add the CurPageChanged(CurPageID: Integer)
procedure, how can I tell it to change FileTemplatePage
?
Where do I have to put it?
Shouldn't I put something like: CurPageChanged(FileTemplatePage.ID)
inside InitializeWizard
?
In general I have problems to understand how the [Code]
part works, isn't there a main function?
I can compile and use this script, and I can visualise the text into the installation page, because the Parent
is that, how can I change the Parent
?.
I tried to do this: CustomStatusLabel.Parent := FileTemplatePage
, but I obtain the error Type mismatch
.
Do you have any advise? Thanks.