Windows 获取NSIS中每个组件的路径
我正在尝试使用NSIS创建一个安装程序,将3个不同的组件安装到三个不同的路径。我希望用户选择/确认每个组件,但只应询问他们是否选择了相关组件 由于页面不能显示在分区中,我不知道如何做到这一点 有什么建议吗Windows 获取NSIS中每个组件的路径,windows,nsis,Windows,Nsis,我正在尝试使用NSIS创建一个安装程序,将3个不同的组件安装到三个不同的路径。我希望用户选择/确认每个组件,但只应询问他们是否选择了相关组件 由于页面不能显示在分区中,我不知道如何做到这一点 有什么建议吗 提前感谢:-)您可以使用多个目录页: !include LogicLib.nsh InstallDir $ProgramFiles32\Foo\Bar Var Comp1Path Var Comp2Path Page Components PageEx Directory Dir
提前感谢:-)您可以使用多个目录页:
!include LogicLib.nsh
InstallDir $ProgramFiles32\Foo\Bar
Var Comp1Path
Var Comp2Path
Page Components
PageEx Directory
DirText "Blah blah 1"
DirVar $Comp1Path
PageCallbacks Comp1Pre
PageExEnd
PageEx Directory
DirText "Blah blah 2"
DirVar $Comp2Path
PageCallbacks Comp2Pre
PageExEnd
Page InstFiles
Section /o Comp1 SID_C1
DetailPrint "Installing Comp1 to $Comp1Path"
SectionEnd
Section Comp2 SID_C2
DetailPrint "Installing Comp2 to $Comp2Path"
SectionEnd
Function Comp1Pre
StrCpy $Comp1Path $InstDir\Comp1
${IfNot} ${SectionIsSelected} ${SID_C1}
Abort ; Skipping this page
${EndIf}
FunctionEnd
Function Comp2Pre
StrCpy $Comp2Path $InstDir\Comp2
${IfNot} ${SectionIsSelected} ${SID_C2}
Abort
${EndIf}
FunctionEnd
; In this example the next button on the components page might be the last page before InstFiles so we have to update the button text
!include WinMessages.nsh
Function .onSelChange
GetDlgItem $1 $hwndParent 1
${If} ${SectionIsSelected} ${SID_C1}
${OrIf} ${SectionIsSelected} ${SID_C2}
SendMessage $1 ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
${Else}
SendMessage $1 ${WM_SETTEXT} 0 "STR:$(^InstallBtn)"
${EndIf}
FunctionEnd
另一种选择是使用nsDialogs创建自定义页面,只禁用或隐藏用户不需要确认的文本字段…默认情况下变量为空,只需将它们设置为此处的某个值,以便“下一步”按钮不会灰显。您可能希望为这些文件指定某种默认路径。你也可以在.onInit中这样做。哎呀!刚回答完我的问题就删除了:-)再次感谢!这真的让我开始了&现在,7个小时后,我有了一个可以工作的安装程序:-)