1 Star 11 Fork 8

tgtsml/InnoSetupScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mainScript.iss 4.66 KB
一键复制 编辑 原始数据 按行查看 历史
tgtsml 提交于 2020-10-29 22:32 . update text format
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppVersion "1.0"
#define MyAppName "appName"
#define MyAppExeName "XCurveFit.exe"
#define MyUninstallAppNmae "uninstall "+MyAppName
#define MyAppPublisher "tgtsml"
#define MyCompanyName "tgtsml"
#define MyAppURL "http://www.example.com/"
#define MyAppId "{{F8ECF68A-7393-4DF0-B6EA-723F5A70A914}"
#define MyAppWindowName "MyAppWindowName"
#define MyAppRunningInstallTips "应用软件正在运行,请退出后重试!"
#define MyAppReinstallTips "'软件已安装,是否覆盖安装?'#13#13'覆盖安装可能会丢失数据,请先备份数据。'"
#define MyAppRunningUninstallTips "应用软件正在运行,请退出后再进行卸载操作!"
#define MyAppDir ".\app"
#define MyResourceDir ".\res"
#define MyImageDir MyResourceDir+"\core"
#define MyLanguageDir MyResourceDir+"\language"
#define MyOutputDir ".\setup"
#define MySetupIconFile MyImageDir+"\setup_icon.ico"
#define MyOutputSetupFileName "mysetup"
#define x64BuildOnly
;#undef x64BuildOnly
#define MyDefaultInstallDir "C:\"+MyCompanyName
#undef MyDefaultInstallDir
[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={#MyAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
OutputDir={#MyOutputDir}
OutputBaseFilename={#MyOutputSetupFileName}
SetupIconFile={#MySetupIconFile}
DisableProgramGroupPage=yes
Compression=lzma
SolidCompression=yes
WizardStyle=modern
#ifdef x64BuildOnly
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={commonpf64}\{#MyCompanyName}\{#MyAppName}
#else
ArchitecturesAllowed=x86 x64
DefaultDirName={commonpf32}\{#MyCompanyName}\{#MyAppName}
#endif
#ifdef MyDefaultInstallDir
DefaultDirName={#MyDefaultInstallDir}\{#MyAppName}
#endif
[Languages]
Name: "chinese"; MessagesFile: "{#MyLanguageDir}\Chinese.isl"
;Name: "english"; MessagesFile: "{#MyLanguageDir}\English.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#MyAppDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyCompanyName}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autoprograms}\{#MyCompanyName}\{#MyUninstallAppNmae}"; Filename:{uninstallexe}; WorkingDir: {app};
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Registry]
Root: HKLM; Subkey: "SOFTWARE\{#MyCompanyName}"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "SOFTWARE\{#MyCompanyName}\{#MyAppName}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\{#MyCompanyName}\{#MyAppName}"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppVersion}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\{#MyCompanyName}\{#MyAppName}"; ValueType: string; ValueName: "ExecuteName"; ValueData: "{#MyAppExeName}"; Flags: uninsdeletekey
[Code]
function IsAppRunning(const AppName : string) : Boolean;
begin
Result := (FindWindowByWindowName(AppName) <> 0);
end;
function IsAppInstalled() : Boolean;
begin
Result := RegKeyExists(HKLM64, 'SOFTWARE\{#MyCompanyName}\{#MyAppName}');
end;
function InitializeSetup(): Boolean;
begin
Result := true;
if IsAppRunning('{#MyAppWindowName}') then
begin
Msgbox('{#MyAppRunningInstallTips}', mbInformation, MB_OK);
Result := false;
end;
if Result and IsAppInstalled() then
begin
Result := (Msgbox({#MyAppReinstallTips}, mbConfirmation, MB_YESNO) = IDYES);
end;
end;
procedure InitializeWizard();
begin
with WizardForm do
begin
Position := poDesktopCenter;
end;
end;
function InitializeUninstall(): Boolean;
begin
Result:= true;
if IsAppRunning('{#MyAppWindowName}') then
begin
MsgBox('{#MyAppRunningUninstallTips}', mbInformation, MB_OK)
Result:= false;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usDone then
begin
DelTree(ExpandConstant('{app}'), True, True, True);
end;
end;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Pascal
1
https://gitee.com/tgtsml/InnoSetupScript.git
git@gitee.com:tgtsml/InnoSetupScript.git
tgtsml
InnoSetupScript
InnoSetupScript
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385