У меня возникли проблемы с пониманием того, как использовать Inno Setup. Я создал этот скрипт для установки моего приложения:
; 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"""
Я создал страницу FileTemplatePage
, чтобы пользователь мог добавить шаблон файла. Я хочу добавить описание на эту страницу.
Оглядевшись, я нашел этот другой вопрос. В основном это именно то, что я хочу, но я действительно не понимаю, как работает скрипт.
Если я добавлю процедуру CurPageChanged(CurPageID: Integer)
, как мне сказать ей изменить FileTemplatePage
? Куда мне его положить? Разве я не должен вставить что-то вроде: CurPageChanged(FileTemplatePage.ID)
внутри InitializeWizard
?
В общем, у меня проблемы с пониманием того, как работает часть [Code]
, разве нет основной функции?
Я могу скомпилировать и использовать этот сценарий, и я могу визуализировать текст на странице установки, потому что Parent
это то, как я могу изменить Parent
?.
Я пытался сделать это: CustomStatusLabel.Parent := FileTemplatePage
, но получаю ошибку Type mismatch
.
Есть ли у вас какие-либо советы? Спасибо.