2014-08-29 4 views
0

세 가지 구성 요소를 세 가지 경로로 설치하는 NSIS를 사용하여 설치 프로그램을 만들려고합니다. 사용자가 각각을 선택/확인하길 원하지만 관련 구성 요소를 선택했는지 묻는 메시지 만 표시해야합니다. 페이지 섹션에 표시 할 수NSIS의 각 구성 요소에 대한 경로 얻기

때문에, 나는 손실에있어 방법이

어떤 제안을 할까?

답변

1

:-) 사전에

덕분에 여러 디렉토리 페이지를 사용할 수는 :

!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와 사용자 정의 페이지를 만들고 단지 비활성화하거나 텍스트를 숨길하는 것은 사용자가하는 필드 확인하지 않아도됩니다 ...

+0

변수는 기본적으로 비어 있으며, 다음 버튼이 회색으로 표시되지 않도록 여기에 설정 만하면됩니다. 이러한 경로에 대해 일종의 기본 경로를 지정하려고합니다. .onInit 등에서도 할 수 있습니다. – Anders

+0

죄송합니다! 내가 대답 한 직후 제 질문을 삭제했습니다 :-) –

+0

다시 한번 감사드립니다! 이것은 정말로 나를 시작했고 & 7 시간이 지난 지금, 나는 작동하는 설치 프로그램을 가지고있다. :-) –