inno setup软件脚本说明
作者:互联网
; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
#define MyAppName "串口网络调试助手"
#define MyAppVersion "1.3"
#define MyAppPublisher "智果芯电子"
#define MyAppURL "https://smartsensors.weebly.com/"
#define MyAppExeName "serial.exe"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
AppId={{CE0CC45F-9B5A-4D91-AD7B-FF95EF4B6CBE}
;应用程序名称
AppName={#MyAppName}
;应用程序版本号
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;默认安装文件夹名
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
InfoBeforeFile=D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\welcom.txt
;InfoAfterFile=D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\finished.txt
; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
;PrivilegesRequired=lowest
OutputDir=D:\Desktop
OutputBaseFilename=serialsetup_1.3
;exe的图标的路径
SetupIconFile=D:\Desktop\QT\serial-v1.3-3.16\system.ico
;使用压缩类算法lzma
Compression=lzma
;固定压缩格式
SolidCompression=yes
WizardStyle=modern
;164x314
;55x58
;必须是bmp格式的图片,路径为绝对路径
WizardImageFile=D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\big.bmp
WizardSmallImageFile=D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\small.bmp
;设置安装界面的语言
[Languages]
;中文语言
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
;英文语言
Name: "english"; MessagesFile: "compiler:English.isl"
[Tasks]
;Tasks: desktopicon 任务:生成快捷方式
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
;生成的快捷方式所指的原执行文件
Source: "D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\serial.exe"; DestDir: "{app}"; Flags: ignoreversion
;打包的目录
Source: "D:\Desktop\QT\build-serial-Desktop_Qt_5_13_2_MinGW_64_bit-Release\release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
[Icons]
;生成开始菜单可执行程序map.exe是你目录下的可执行文件 WorkingDir: {app}” WorkingDir后面加{app} app的意思是随安装目录生成
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
;生成开始菜单卸载
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}";WorkingDir:"{app}"
;Tasks: desktopicon 上面任务中的,生成快捷方式
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
; Code下面代码是自己添加的,不是系统西东生成的
[Code]
var
ErrorCode: Integer;
IsRunning: Integer;
//判定程序已经被安装过而不需要重复安装,判断当前安装路径下已经有要安装的exe
// 安装时判断客户端是否正在运行
function InitializeSetup(): Boolean;
begin
Result :=true; //安装程序继续
if FileExists(ExpandConstant('{pf}\test\test.exe')) then
begin
MsgBox('程序已经安装在你的系统中了!', mbInformation, MB_OK );
Result := false;
end;
IsRunning:=FindWindowByWindowName('test');
while IsRunning<>0 do
begin
if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNO then
begin
Result :=false; //安装程序退出
IsRunning :=0;
end else begin
Result :=true; //安装程序继续
IsRunning:=FindWindowByWindowName('test');
end;
end;
end;
// 卸载时判断客户端是否正在运行
function InitializeUninstall(): Boolean;
begin
Result :=true; //安装程序继续
IsRunning:=FindWindowByWindowName('test');
while IsRunning<>0 do
begin
if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNO then
begin
Result :=false; //安装程序退出
IsRunning :=0;
end else begin
Result :=true; //安装程序继续
IsRunning:=FindWindowByWindowName('test');
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usUninstall:
begin // 开始卸载
end;
usPostUninstall:
begin // 卸载完成
//MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall just finished.', mbInformation, MB_OK);
//插入代码执行卸载后的任务
//ShellExec('open', 'http://www.baidu.com', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
end;
标签:begin,end,setup,13,Desktop,安装程序,inno,软件,app 来源: https://blog.csdn.net/qq_39400113/article/details/114978736