0

我正在使用 NSIS 创建一个设置,其中包括一些内置页面和一些自定义页面。我想仅在安装期间传递命令行时才使用安装显示自定义页面。如何完成?

例子

!include "MUI.nsh"
!include nsDialogs.nsh

OutFile "myCustomPage.exe"
var installmethod
Page Custom MyCustomPage 
Page Custom MyCustomPage1 
Page Custom MyCustomPage3

Function MyCustomPage
 nsDialogs::Create 1044

     nsDialogs::Show

FunctionEnd
Function MyCustomPage1
 nsDialogs::Create 1044

     nsDialogs::Show

FunctionEnd
Function MyCustomPage3
 nsDialogs::Create 1044

     nsDialogs::Show
FunctionEnd
Section Dummy
SectionEnd

在上面的示例中,我有 3 个页面。在正常安装期间,我只想显示两个页面 MyCustomPage 和 MyCustomPage3。如果通过了命令行(指定命令行),那么安装过程中应该出现所有 3 个页面。如何完成?

4

2 回答 2

1
!include FileFunc.nsh
!include LogicLib.nsh

Page Custom MyPageCreate

Function MyPageCreate
${GetParameters} $0
ClearErrors
${GetOptions} "$0" "/ShowSpecial"  $1
${If} ${Errors}
    Abort ; Skip page
${EndIf}
nsDialogs::Create 1044
nsDialogs::Show
FunctionEnd
于 2013-10-05T09:20:41.090 回答
0

如果命令行选项是“a”,下面的代码会跳过页面 MyCustomPage1。

!include "MUI.nsh"
!include "FileFunc.nsh"
!include nsDialogs.nsh
!insertmacro GetParameters

OutFile "myCustomPage.exe"
var installmethod
Page Custom MyCustomPage 
Page Custom MyCustomPage1 
Page Custom MyCustomPage3

Function MyCustomPage
    nsDialogs::Create 1044
    nsDialogs::Show
FunctionEnd

Function MyCustomPage1
    ${GetParameters} $R0
    ${If} $R0 == 'a'
        abort
    ${EndIf}
    nsDialogs::Create 1044
    nsDialogs::Show
FunctionEnd

Function MyCustomPage3
    nsDialogs::Create 1044
    nsDialogs::Show
FunctionEnd

Section Dummy
SectionEnd
于 2013-10-05T10:55:15.170 回答