1 | ;NSIS Modern User Interface |
---|
2 | ;Start Menu Folder Selection Example Script |
---|
3 | ;Written by Joost Verburg |
---|
4 | |
---|
5 | ;-------------------------------- |
---|
6 | ;Include Modern UI |
---|
7 | |
---|
8 | !include "MUI2.nsh" |
---|
9 | |
---|
10 | ;-------------------------------- |
---|
11 | ;General |
---|
12 | |
---|
13 | ;Name and file |
---|
14 | Name "Modern UI Test" |
---|
15 | OutFile "StartMenu.exe" |
---|
16 | |
---|
17 | ;Default installation folder |
---|
18 | InstallDir "$LOCALAPPDATA\Modern UI Test" |
---|
19 | |
---|
20 | ;Get installation folder from registry if available |
---|
21 | InstallDirRegKey HKCU "Software\Modern UI Test" "" |
---|
22 | |
---|
23 | ;Request application privileges for Windows Vista |
---|
24 | RequestExecutionLevel user |
---|
25 | |
---|
26 | ;-------------------------------- |
---|
27 | ;Variables |
---|
28 | |
---|
29 | Var StartMenuFolder |
---|
30 | |
---|
31 | ;-------------------------------- |
---|
32 | ;Interface Settings |
---|
33 | |
---|
34 | !define MUI_ABORTWARNING |
---|
35 | |
---|
36 | ;-------------------------------- |
---|
37 | ;Pages |
---|
38 | |
---|
39 | !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" |
---|
40 | !insertmacro MUI_PAGE_COMPONENTS |
---|
41 | !insertmacro MUI_PAGE_DIRECTORY |
---|
42 | |
---|
43 | ;Start Menu Folder Page Configuration |
---|
44 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" |
---|
45 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Modern UI Test" |
---|
46 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" |
---|
47 | |
---|
48 | !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder |
---|
49 | |
---|
50 | !insertmacro MUI_PAGE_INSTFILES |
---|
51 | |
---|
52 | !insertmacro MUI_UNPAGE_CONFIRM |
---|
53 | !insertmacro MUI_UNPAGE_INSTFILES |
---|
54 | |
---|
55 | ;-------------------------------- |
---|
56 | ;Languages |
---|
57 | |
---|
58 | !insertmacro MUI_LANGUAGE "English" |
---|
59 | |
---|
60 | ;-------------------------------- |
---|
61 | ;Installer Sections |
---|
62 | |
---|
63 | Section "Dummy Section" SecDummy |
---|
64 | |
---|
65 | SetOutPath "$INSTDIR" |
---|
66 | |
---|
67 | ;ADD YOUR OWN FILES HERE... |
---|
68 | |
---|
69 | ;Store installation folder |
---|
70 | WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR |
---|
71 | |
---|
72 | ;Create uninstaller |
---|
73 | WriteUninstaller "$INSTDIR\Uninstall.exe" |
---|
74 | |
---|
75 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application |
---|
76 | |
---|
77 | ;Create shortcuts |
---|
78 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" |
---|
79 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" |
---|
80 | |
---|
81 | !insertmacro MUI_STARTMENU_WRITE_END |
---|
82 | |
---|
83 | SectionEnd |
---|
84 | |
---|
85 | ;-------------------------------- |
---|
86 | ;Descriptions |
---|
87 | |
---|
88 | ;Language strings |
---|
89 | LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." |
---|
90 | |
---|
91 | ;Assign language strings to sections |
---|
92 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
---|
93 | !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy) |
---|
94 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
---|
95 | |
---|
96 | ;-------------------------------- |
---|
97 | ;Uninstaller Section |
---|
98 | |
---|
99 | Section "Uninstall" |
---|
100 | |
---|
101 | ;ADD YOUR OWN FILES HERE... |
---|
102 | |
---|
103 | Delete "$INSTDIR\Uninstall.exe" |
---|
104 | |
---|
105 | RMDir "$INSTDIR" |
---|
106 | |
---|
107 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder |
---|
108 | |
---|
109 | Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" |
---|
110 | RMDir "$SMPROGRAMS\$StartMenuFolder" |
---|
111 | |
---|
112 | DeleteRegKey /ifempty HKCU "Software\Modern UI Test" |
---|
113 | |
---|
114 | SectionEnd |
---|