Al *_*l C 2 inno-setup upgrade
我的InnoSetup脚本在安装过程结束时打开一个网页(使用用户的默认浏览器):
[Run]
Filename: http://example.com; Flags: shellexec
Run Code Online (Sandbox Code Playgroud)
但是,如果应用程序已经存在,即使用户正在安装新版本的程序,我希望不打开该网页.只应在初始安装后打开网页.(我认为值得一提的是,安装显然包含AppID,并在安装文件旁边的注册表中输入值.)
谢谢你,一如既往 - Al C.
是的,这很容易用脚本编写.
写吧
[Run]
Filename: "http://example.com"; Flags: shellexec; Check: NotAnUpdate
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
IsUpdate := FileExists(ExpandConstant('{app}\TheFileNameOfMyApp.exe'));
end;
function NotAnUpdate: Boolean;
begin
result := not IsUpdate;
end;
Run Code Online (Sandbox Code Playgroud)
如果用户选择将可执行文件安装到与上次不同的位置,@AndreasRejbrand 的答案将不起作用。
您可以查询特定于安装程序的 Inno Setup 注册表项:
#define AppId "your-app-id"
#define SetupReg \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\" + AppId + "_is1"
#define SetupAppPathReg "Inno Setup: App Path"
[Setup]
AppId={#AppId}
...
[Run]
Filename: "https://www.example.com/"; Flags: shellexec; Check: not IsUpgrade
...
Run Code Online (Sandbox Code Playgroud)
[Code]
function IsUpgrade: Boolean;
var
S: string;
begin
Result :=
RegQueryStringValue(HKLM, '{#SetupReg}', '{#SetupAppPathReg}', S) or
RegQueryStringValue(HKCU, '{#SetupReg}', '{#SetupAppPathReg}', S);
end;
Run Code Online (Sandbox Code Playgroud)
有关如何使用IsUpgradein[Code]部分的示例,请参阅
如果在 Inno Setup 中更新安装,则排除 ssPostInstall 步骤中的部分代码部分
如果您的“AppId”包含左大括号,请检查此项:
当 AppId 包含大括号时,检查安装是否是全新的或升级不起作用
| 归档时间: |
|
| 查看次数: |
1051 次 |
| 最近记录: |