new example: start menu folder selection
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1645 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4103e6cd77
commit
7b04942e8a
1 changed files with 102 additions and 0 deletions
102
Examples/Modern UI/StartMenu.nsi
Normal file
102
Examples/Modern UI/StartMenu.nsi
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
;NSIS Modern User Interface version 1.5
|
||||||
|
;Start Menu Folder Selection Example Script
|
||||||
|
;Written by Joost Verburg
|
||||||
|
|
||||||
|
!define MUI_PRODUCT "Test Software" ;Define your own software name here
|
||||||
|
!define MUI_VERSION "1.0" ;Define your own software version here
|
||||||
|
|
||||||
|
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
|
||||||
|
|
||||||
|
;$9 is being used to store the Start Menu Folder.
|
||||||
|
;Do not use this variable in your script!
|
||||||
|
|
||||||
|
;You can change this variable or the default Start Menu Folder by using
|
||||||
|
;these defines:
|
||||||
|
;!define MUI_STARTMENU_VARIABLE "$VARNAME"
|
||||||
|
;!define MUI_STARTMENU_DEFAULTFOLDER "Folder Name"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Configuration
|
||||||
|
|
||||||
|
!define MUI_LICENSEPAGE
|
||||||
|
!define MUI_COMPONENTSPAGE
|
||||||
|
!define MUI_DIRECTORYPAGE
|
||||||
|
!define MUI_ABORTWARNING
|
||||||
|
!define MUI_UNINSTALLER
|
||||||
|
|
||||||
|
!define MUI_STARTMENUPAGE
|
||||||
|
|
||||||
|
!define TEMP1 $R0
|
||||||
|
|
||||||
|
;Language
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
;General
|
||||||
|
OutFile "StartMenu.exe"
|
||||||
|
|
||||||
|
;License page
|
||||||
|
LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"
|
||||||
|
|
||||||
|
;Descriptions
|
||||||
|
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy the modern.exe file to the application folder."
|
||||||
|
|
||||||
|
;Folder-selection page
|
||||||
|
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Modern UI System
|
||||||
|
|
||||||
|
!insertmacro MUI_SYSTEM
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Installer Sections
|
||||||
|
|
||||||
|
Section "modern.exe" SecCopyUI
|
||||||
|
|
||||||
|
;ADD YOUR OWN STUFF HERE!
|
||||||
|
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File "${NSISDIR}\Contrib\UIs\modern.exe"
|
||||||
|
|
||||||
|
;Create shortcut
|
||||||
|
CreateDirectory "$SMPROGRAMS\${MUI_STARTMENU_VARIABLE}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\${MUI_STARTMENU_VARIABLE}\Modern UI.lnk" "$INSTDIR\modern.exe"
|
||||||
|
|
||||||
|
;Write shortcut location to the registry (for Uninstaller)
|
||||||
|
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "Start Menu Folder" "${MUI_STARTMENU_VARIABLE}"
|
||||||
|
|
||||||
|
;Create uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
!insertmacro MUI_SECTIONS_FINISHHEADER ;Insert this macro after the sections
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Descriptions
|
||||||
|
|
||||||
|
!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
|
||||||
|
!insertmacro MUI_FUNCTIONS_DESCRIPTION_END
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Uninstaller Section
|
||||||
|
|
||||||
|
Section "Uninstall"
|
||||||
|
|
||||||
|
;ADD YOUR OWN STUFF HERE!
|
||||||
|
|
||||||
|
Delete "$INSTDIR\modern.exe"
|
||||||
|
Delete "$INSTDIR\Uninstall.exe"
|
||||||
|
|
||||||
|
;Remove shortcut
|
||||||
|
ReadRegStr ${TEMP1} HKCU "Software\${MUI_PRODUCT}" "Start Menu Folder"
|
||||||
|
Delete "$SMPROGRAMS\${TEMP1}\Modern UI.lnk"
|
||||||
|
RMDir "$SMPROGRAMS\${TEMP1}" ;Only if empty, so it won't delete other shortcuts
|
||||||
|
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
|
;Display the Finish header
|
||||||
|
!insertmacro MUI_UNFINISHHEADER
|
||||||
|
|
||||||
|
SectionEnd
|
Loading…
Add table
Add a link
Reference in a new issue