Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; XXinst.nsi
- ;
- ; Installer for XXXXXXX
- ;
- ;--------------------------------
- ; use modern user interface
- !include "MUI2.nsh"
- ; Setting variables
- ; The name of the installer
- Name "XXXXXXXXXX"
- ; The file to write
- OutFile "XXinstall.exe"
- ; The default installation directory
- InstallDir $PROGRAMFILES\XXXXXXXXX
- ; Registry key to check for directory (so if you install again,
- ; it will overwrite the old one automatically)
- InstallDirRegKey HKLM "Software\XXXXXXXXX" "Install_Dir"
- ; Request application privileges for Windows Vista
- RequestExecutionLevel admin
- ;--------------------------------
- ;Interface Settings
- !define MUI_ABORTWARNING
- ;--------------------------------
- ; Pages
- !insertmacro MUI_PAGE_LICENSE "XXlicense.txt"
- !insertmacro MUI_PAGE_COMPONENTS
- !insertmacro MUI_PAGE_DIRECTORY
- !insertmacro MUI_PAGE_INSTFILES
- Var StartMenuFolder
- !insertmacro MUI_PAGE_STARTMENU "XX" $StartMenuFolder
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
- ;--------------------------------
- ;Languages
- !insertmacro MUI_LANGUAGE "English"
- ;--------------------------------
- ; The stuff to install
- Section "The application (required)" XX
- SectionIn RO
- ; Set output path to the installation directory.
- SetOutPath $INSTDIR
- ; Put file there
- File "XX_fe.mde"
- File "XX_be.mdb"
- ; Write the installation path into the registry
- WriteRegStr HKLM SOFTWARE\XXXXXXXXX "Install_Dir" "$INSTDIR"
- ; Write the uninstall keys for Windows
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "DisplayName" "Question Builder"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "UninstallString" '"$INSTDIR\uninstall.exe"'
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoRepair" 1
- WriteUninstaller "uninstall.exe"
- SectionEnd
- ; Optional section (can be disabled by the user)
- Section "Start Menu Shortcuts" SMshorts
- !insertmacro MUI_STARTMENU_WRITE_BEGIN XX
- CreateDirectory "$SMPROGRAMS\XXXXXXXXX"
- CreateShortCut "$SMPROGRAMS\XXXXXXXXX\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
- CreateShortCut "$SMPROGRAMS\XXXXXXXXX\XXXXXXX.lnk" "$INSTDIR\XX_fe.mde" "" "$INSTDIR\XX_fe.mde" 0
- !insertmacro MUI_STARTMENU_WRITE_END
- SectionEnd
- ; Optional section (can be disabled by the user)
- Section "Desktop Shortcut" DTshorts
- CreateShortCut "$DESKTOP\XXXXXXXX.lnk" "$INSTDIR\XX_fe.mde" "" "$INSTDIR\XX_fe.mde" 0
- SectionEnd
- ; Optional section (can be disabled by the user) ; This section not finished yet ********
- Section "Access Runtime" RunT
- ; Set output path to the installation directory.
- SetOutPath $INSTDIR
- ; Put file there
- File "XX_fe.mde"
- ; Write the installation path into the registry
- WriteRegStr HKLM SOFTWARE\XXXXXXXXX "Install_Dir" "$INSTDIR"
- ; Write the uninstall keys for Windows
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "DisplayName" "NSIS Example2"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "UninstallString" '"$INSTDIR\uninstall.exe"'
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoRepair" 1
- WriteUninstaller "uninstall.exe"
- SectionEnd
- ;--------------------------------
- ;Descriptions
- ;Language strings
- LangString DESC_XX ${LANG_ENGLISH} "The application."
- LangString DESC_SMshorts ${LANG_ENGLISH} "Start Menu shortcuts."
- LangString DESC_DTshorts ${LANG_ENGLISH} "Desktop shortcut."
- LangString DESC_RunT ${LANG_ENGLISH} "Access Runtime$\r$\n(Select this if you do not have Microsoft Access installed on your computer)."
- ;Assign language strings to sections
- !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${XX} $(DESC_XX)
- !insertmacro MUI_DESCRIPTION_TEXT ${SMshorts} $(DESC_SMshorts)
- !insertmacro MUI_DESCRIPTION_TEXT ${DTshorts} $(DESC_DTshorts)
- !insertmacro MUI_DESCRIPTION_TEXT ${RunT} $(DESC_RunT)
- !insertmacro MUI_FUNCTION_DESCRIPTION_END
- ;--------------------------------
- ; Uninstaller
- Section "Uninstall"
- ; Remove registry keys
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX"
- DeleteRegKey HKLM SOFTWARE\XXXXXXXXX
- ; Remove files and uninstaller
- Delete $INSTDIR\XX_fe.mde
- Delete $INSTDIR\XX_be.mdb
- Delete $INSTDIR\uninstall.exe
- ; Remove shortcuts, if any
- Delete "$SMPROGRAMS\XXXXXXXXX\*.*"
- ; Remove directories used
- RMDir "$SMPROGRAMS\XXXXXXXXX"
- RMDir "$INSTDIR"
- SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement