Inno Setup 和 Check 中的两个条件
Inno Setup and Two conditions in Check
我正在为我的应用程序编写一个简单的 Inno 安装脚本。
我做了我想做的所有事情,但我在阻止某些事情。
我的应用程序有两种模式,用户在安装开始时选择计算机和客户端。如果选择客户端模式,应用程序必须以 windows 开头。
此外,我的应用程序可以安装在 Windows 版本(32 位和 64 位)上,因此注册表项的路径不同。
为了让它以 windows 开头,我在我的 Inno 安装脚本的末尾添加了这个:
[Registry]
Check: IsWin64; Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; Permissions: users-full; ValueName: "MyApp"; ValueData: "{app}\AutoexecX86.cmd";
Check: Not IsWin64; Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; Permissions: users-full; ValueName: "MyApp"; ValueData: "{app}\Autoexec.cmd";
如何添加我的应用程序仅在 "Client mode is choosen" 条件下启动的条件。 (ClientRadioButton.Checked
)
Check
parameter 文档说:
Besides a single name, you may also use boolean expressions. See Components and Tasks parameters for examples of boolean expressions.
Components and Tasks parameters 文档说:
Besides space separated lists, you may also use boolean expressions as Components and Tasks parameters. Supported operators include not
, and
, and or
. ...
所以,添加一个辅助函数,如IsClientMode
:
function IsClientMode: Boolean;
begin
Result := ClientRadioButton.Checked;
end;
并使用 and
布尔运算符将其与您现有的 IsWin64
条件结合起来:
[Registry]
Check: IsWin64 and IsClientMode; ...
Check: (not IsWin64) and IsClientMode; ...
我正在为我的应用程序编写一个简单的 Inno 安装脚本。 我做了我想做的所有事情,但我在阻止某些事情。
我的应用程序有两种模式,用户在安装开始时选择计算机和客户端。如果选择客户端模式,应用程序必须以 windows 开头。 此外,我的应用程序可以安装在 Windows 版本(32 位和 64 位)上,因此注册表项的路径不同。
为了让它以 windows 开头,我在我的 Inno 安装脚本的末尾添加了这个:
[Registry]
Check: IsWin64; Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; Permissions: users-full; ValueName: "MyApp"; ValueData: "{app}\AutoexecX86.cmd";
Check: Not IsWin64; Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; Permissions: users-full; ValueName: "MyApp"; ValueData: "{app}\Autoexec.cmd";
如何添加我的应用程序仅在 "Client mode is choosen" 条件下启动的条件。 (ClientRadioButton.Checked
)
Check
parameter 文档说:
Besides a single name, you may also use boolean expressions. See Components and Tasks parameters for examples of boolean expressions.
Components and Tasks parameters 文档说:
Besides space separated lists, you may also use boolean expressions as Components and Tasks parameters. Supported operators include
not
,and
, andor
. ...
所以,添加一个辅助函数,如IsClientMode
:
function IsClientMode: Boolean;
begin
Result := ClientRadioButton.Checked;
end;
并使用 and
布尔运算符将其与您现有的 IsWin64
条件结合起来:
[Registry]
Check: IsWin64 and IsClientMode; ...
Check: (not IsWin64) and IsClientMode; ...