2014-09-10 3 views
0

우리는) ​​바로 가기 1을 만들어 현재 사용자 2 바로 가기를 만들 수) 바로 가기를세 가지 선택이

에게 첫 번째 옵션을 생성하지 않는 모든 사용자 3)에 대한 바로 가기를 만들 수있는 몇 가지 선택이 우리의 설치를 다른 것들이 잘 작동하는지 체크하면 기본값으로 체크됩니다 .. 문제는 제가 3 번째 옵션을 체크하면 다음 페이지로 이동하고 다시 2 가지 선택을합니다 - 첫 번째 (기본값)와 세 번째 (선택됨)입니다.

나는 NSIS에 매우 익숙하며, 코드가 나에게 매우 친숙하지 않기 때문에 내가했던 것보다 더 좋은 방법을 찾을 수 없다. 조언을 부탁드립니다.

이 내가 내 설치 옵션이 무엇인지입니다

덕분에, .ini 파일 :

[Field 5] 
Type=GroupBox 
Left=1 
Right=-1 
Top=80 
Bottom=144 
Text="Choice of shortcuts:" 
State="" 

[Field 6] 
Type=RadioButton 
Left=10 
Right=-10 
Top=96 
Bottom=108 
Text="Create shortcuts for all users" 
State=1 
Flags=GROUP|NOTIFY 

[Field 7] 
Type=RadioButton 
Left=10 
Right=-10 
Top=112 
Bottom=124 
Text="Create shortcuts only for a current user" 
State=0 
Flags=NOTIFY 

[Field 8] 
Type=RadioButton 
Text="Do not create shortcut" 
Flags=NOTIFY 
State=0 
Left=10 
Right=-10 
Top=128 
Bottom=140 

그런 다음 나중에 NSIS 스크립트 :

IntCmp $ShortcutsForAllUsers 1 ShortcutsForAll ShortcutsForCurrentUser ShortcutsForCurrentUser 

ShortcutsForAll: 
SetShellVarContext all 
goto done 

ShortcutsForCurrentUser: 
SetShellVarContext current 
goto done 

NoShortcuts: 
goto done 

done: 
FunctionEnd 
+0

어쩌면 당신은 nsDialogs을 시도해 볼 수도 있습니다 ... 올바른 시작 메뉴 폴더에 $에게 SMPrograms지도하지 않을 수 있습니다. 이 InstallOption 플러그인은 사용하기가 매우 오래되었으며 이제는이 문제를 일으킬 수 있습니다. – Slappy

답변

0

에서 InstallOptions 페이지로 상태를 기억한다 페이지 생성 콜백 함수에서 매번 추출하지 않는 한 오래. UAC는 다른 관리자 사용자와 프로세스를 높일 수 있기 때문에이 디자인에 문제가 있습니다

!include LogicLib.nsh 
!include InstallOptions.nsh 
ChangeUI All "${NSISDIR}\Contrib\UIs\modern.exe" 

Function .onInit 
!insertmacro INSTALLOPTIONS_EXTRACT_AS "...\test.ini" "iosp.ini" 
FunctionEnd 

Var ShortcutMode 

Page Custom MyShortcutPageCreate MyShortcutPageLeave 
Page Components 
Page InstFiles 

Function MyShortcutPageCreate 
!insertmacro INSTALLOPTIONS_DISPLAY "iosp.ini" 
FunctionEnd 

Function MyShortcutPageLeave 
!insertmacro INSTALLOPTIONS_READ $0 "iosp.ini" "Settings" "State" 
${If} $0 > 0 
    IntOp $ShortcutMode $0 - 6 ; Map .ini Field Id to 0 (or empty), 1 or 2 
    Abort 
${EndIf} 
FunctionEnd 

Section 
${If} $ShortcutMode = 0 
    SetShellVarContext all 
${ElseIf} $ShortcutMode = 1 
    SetShellVarContext current 
${EndIf} 
... 
SectionEnd 

SetShellVarContext current