TimeMaster/TimeMaster.iss.template

84 lines
2.9 KiB
Plaintext

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "%APPNAME%"
#define MyAppExec "%APPEXEC%"
#define MyAppVersion "%APPVERSION%"
#define MyAppBuildDate "%APPBUILDDATE%"
#define MyAppPublisher "%APPPUBLISHER%"
#define MyAppPublisherURL "%APPPUBLISHERURL%"
[Code]
function IsProcessRunning(ExeFileName: string): Boolean;
var
FSWbemLocator: Variant;
FWMIService: Variant;
FWbemObject: Variant;
begin
Result := False;
FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2');
FWbemObject := FWMIService.ExecQuery(Format('SELECT * FROM Win32_Process Where Name = "%s"', [ExeFileName]));
Result := not VarIsNull(FWbemObject) and (FWbemObject.Count > 0);
end;
function InitializeSetup(): Boolean;
begin
if IsProcessRunning(ExpandConstant('{#MyAppExec}.exe')) then
begin
MsgBox('The main program is still running, please close it before installation.', mbError, MB_OK);
Result := False;
end
else
begin
Result := True;
end;
end;
[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={{7E345AAD-FB40-CAF0-B0FC-3A4CBD445240}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
VersionInfoProductName={#MyAppName}
VersionInfoProductTextVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename={#MyAppName} Setup {#MyAppVersion}
OutputDir={#MyAppExec}.output
SetupIconFile={#MyAppExec}.dist\favicon.ico
UninstallDisplayIcon={app}\{#MyAppExec}.exe
Compression=lzma
SolidCompression=yes
WizardStyle=modern
CloseApplications=yes
%DISABLEX64%ArchitecturesAllowed=x64compatible
%DISABLEX64%ArchitecturesInstallIn64BitMode=x64compatible
[UninstallRun]
Filename: "cmd.exe"; Parameters: "/C taskkill /IM {#MyAppExec}.exe /F"; Flags: runhidden
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#MyAppExec}.dist\{#MyAppExec}.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppExec}.dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExec}.exe"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExec}.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExec}.exe"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent