Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; XXinst.nsi
  2. ;
  3. ; Installer for XXXXXXX
  4. ;
  5. ;--------------------------------
  6. ; use modern user interface
  7.  
  8.   !include "MUI2.nsh"
  9.  
  10. ; Setting variables
  11.  
  12. ; The name of the installer
  13.   Name "XXXXXXXXXX"
  14.  
  15. ; The file to write
  16.   OutFile "XXinstall.exe"
  17.  
  18. ; The default installation directory
  19.   InstallDir $PROGRAMFILES\XXXXXXXXX
  20.  
  21. ; Registry key to check for directory (so if you install again,  
  22. ; it will overwrite the old one automatically)
  23.   InstallDirRegKey HKLM "Software\XXXXXXXXX" "Install_Dir"
  24.  
  25. ; Request application privileges for Windows Vista
  26.   RequestExecutionLevel admin
  27.  
  28. ;--------------------------------
  29. ;Interface Settings
  30.  
  31.   !define MUI_ABORTWARNING
  32.  
  33. ;--------------------------------
  34.  
  35. ; Pages
  36.  
  37.   !insertmacro MUI_PAGE_LICENSE "XXlicense.txt"
  38.   !insertmacro MUI_PAGE_COMPONENTS
  39.   !insertmacro MUI_PAGE_DIRECTORY
  40.   !insertmacro MUI_PAGE_INSTFILES
  41.   Var StartMenuFolder
  42.   !insertmacro MUI_PAGE_STARTMENU "XX" $StartMenuFolder
  43.  
  44.   !insertmacro MUI_UNPAGE_CONFIRM
  45.   !insertmacro MUI_UNPAGE_INSTFILES
  46.  
  47. ;--------------------------------
  48. ;Languages
  49.  
  50.   !insertmacro MUI_LANGUAGE "English"
  51.  
  52. ;--------------------------------
  53.  
  54. ; The stuff to install
  55.  
  56. Section "The application (required)" XX
  57.  
  58.   SectionIn RO
  59.  
  60.   ; Set output path to the installation directory.
  61.   SetOutPath $INSTDIR
  62.  
  63.   ; Put file there
  64.   File "XX_fe.mde"
  65.   File "XX_be.mdb"
  66.  
  67.   ; Write the installation path into the registry
  68.   WriteRegStr HKLM SOFTWARE\XXXXXXXXX "Install_Dir" "$INSTDIR"
  69.  
  70.   ; Write the uninstall keys for Windows
  71.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "DisplayName" "Question Builder"
  72.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "UninstallString" '"$INSTDIR\uninstall.exe"'
  73.   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoModify" 1
  74.   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoRepair" 1
  75.   WriteUninstaller "uninstall.exe"
  76.  
  77. SectionEnd
  78.  
  79. ; Optional section (can be disabled by the user)
  80. Section "Start Menu Shortcuts" SMshorts
  81.  
  82.   !insertmacro MUI_STARTMENU_WRITE_BEGIN XX
  83.     CreateDirectory "$SMPROGRAMS\XXXXXXXXX"
  84.     CreateShortCut "$SMPROGRAMS\XXXXXXXXX\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  85.     CreateShortCut "$SMPROGRAMS\XXXXXXXXX\XXXXXXX.lnk" "$INSTDIR\XX_fe.mde" "" "$INSTDIR\XX_fe.mde" 0
  86.   !insertmacro MUI_STARTMENU_WRITE_END
  87.  
  88. SectionEnd
  89.  
  90. ; Optional section (can be disabled by the user)
  91. Section "Desktop Shortcut" DTshorts
  92.  
  93.  
  94.   CreateShortCut "$DESKTOP\XXXXXXXX.lnk" "$INSTDIR\XX_fe.mde" "" "$INSTDIR\XX_fe.mde" 0
  95.  
  96.  
  97. SectionEnd
  98.  
  99. ; Optional section (can be disabled by the user)   ; This section not finished yet ********
  100. Section "Access Runtime" RunT
  101.  
  102.   ; Set output path to the installation directory.
  103.   SetOutPath $INSTDIR
  104.  
  105.   ; Put file there
  106.   File "XX_fe.mde"
  107.  
  108.   ; Write the installation path into the registry
  109.   WriteRegStr HKLM SOFTWARE\XXXXXXXXX "Install_Dir" "$INSTDIR"
  110.  
  111.   ; Write the uninstall keys for Windows
  112.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "DisplayName" "NSIS Example2"
  113.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "UninstallString" '"$INSTDIR\uninstall.exe"'
  114.   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoModify" 1
  115.   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX" "NoRepair" 1
  116.   WriteUninstaller "uninstall.exe"
  117.  
  118. SectionEnd
  119.  
  120. ;--------------------------------
  121. ;Descriptions
  122.  
  123.   ;Language strings
  124.   LangString DESC_XX ${LANG_ENGLISH} "The application."
  125.   LangString DESC_SMshorts ${LANG_ENGLISH} "Start Menu shortcuts."
  126.   LangString DESC_DTshorts ${LANG_ENGLISH} "Desktop shortcut."
  127.   LangString DESC_RunT ${LANG_ENGLISH} "Access Runtime$\r$\n(Select this if you do not have Microsoft Access installed on your computer)."
  128.  
  129.   ;Assign language strings to sections
  130.   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  131.     !insertmacro MUI_DESCRIPTION_TEXT ${XX} $(DESC_XX)
  132.     !insertmacro MUI_DESCRIPTION_TEXT ${SMshorts} $(DESC_SMshorts)
  133.     !insertmacro MUI_DESCRIPTION_TEXT ${DTshorts} $(DESC_DTshorts)
  134.     !insertmacro MUI_DESCRIPTION_TEXT ${RunT} $(DESC_RunT)
  135.   !insertmacro MUI_FUNCTION_DESCRIPTION_END
  136.  
  137. ;--------------------------------
  138.  
  139. ; Uninstaller
  140.  
  141. Section "Uninstall"
  142.  
  143.   ; Remove registry keys
  144.   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXXXXXXXX"
  145.   DeleteRegKey HKLM SOFTWARE\XXXXXXXXX
  146.  
  147.   ; Remove files and uninstaller
  148.   Delete $INSTDIR\XX_fe.mde
  149.   Delete $INSTDIR\XX_be.mdb
  150.   Delete $INSTDIR\uninstall.exe
  151.  
  152.   ; Remove shortcuts, if any
  153.   Delete "$SMPROGRAMS\XXXXXXXXX\*.*"
  154.  
  155.   ; Remove directories used
  156.   RMDir "$SMPROGRAMS\XXXXXXXXX"
  157.   RMDir "$INSTDIR"
  158.  
  159. SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement