我已经使用Inno Setup设计了安装程序,以显示2个组件供用户选择。根据他/她的选择,最后的“完成”页面将显示“启动程序”复选框。如果两个组件都被选中,则该复选框的默认值为false。
到目前为止,一切都很好。
现在,我希望如果用户仅选择一个组件进行安装,则复选框的默认值应为true。
以下是安装程序的“组件”和“运行”部分,
[Components]
Name: "Component1"; Description: "Component1"; Types: full;
Name: "Component2"; Description: "Component2"; Types: full custom;
[Run]
Filename: "{localappdata}\MyInstaller\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent unchecked; Components:Component1;
Filename: "{localappdata}\MyInstaller\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(TestAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent unchecked; Components:Component2
我知道我想要的东西需要做一些脚本编写。我不知所措。
请指导。
该Components
参数允许您使用布尔表达式运算符,因此对于您的情况,您可以编写两对条目,其中一对用于未选中复选框,第二对用于选中。剩下的您需要编写一个表达式:
[Components]
Name: "Component1"; Description: "Component1";
Name: "Component2"; Description: "Component2";
[Run]
; this is the entry pair for unchecked check box; it is shown if both components
; are selected
Filename: "{app}\MyProg1.exe"; Flags: nowait postinstall skipifsilent unchecked; Components: Component1 and Component2;
Filename: "{app}\MyProg2.exe"; Flags: nowait postinstall skipifsilent unchecked; Components: Component1 and Component2;
; this is the entry pair for checked check box; it is shown only when the given
; component is selected and the other not
Filename: "{app}\MyProg1.exe"; Flags: nowait postinstall skipifsilent; Components: Component1 and not Component2;
Filename: "{app}\MyProg2.exe"; Flags: nowait postinstall skipifsilent; Components: Component2 and not Component1;
这将产生:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句