我正在创建一个使用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个页面。可以这样做吗?
答案 0 :(得分: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
答案 1 :(得分:0)
下面的代码跳过页面命令行选项的MyCustomPage 1是“a”。
!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