home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / nastroje / d23456 / NSIS.EXE / example2.nsi < prev    next >
Text File  |  2001-05-19  |  2KB  |  68 lines

  1. ; example2.nsi
  2. ;
  3. ; This script is based on example1.nsi, but adds uninstall support
  4. ; and (optionally) start menu shortcuts.
  5. ;
  6. ; It will install notepad.exe into a directory that the user selects,
  7. ;
  8.  
  9. ; The name of the installer
  10. Name "Example2"
  11.  
  12. ; The file to write
  13. OutFile "example2.exe"
  14.  
  15. ; The default installation directory
  16. InstallDir $PROGRAMFILES\Example2
  17. ; Registry key to check for directory (so if you install again, it will 
  18. ; overwrite the old one automatically)
  19. InstallDirRegKey HKLM SOFTWARE\NSIS_Example2 "Install_Dir"
  20.  
  21. ; The text to prompt the user to enter a directory
  22. ComponentText "This will install the less simple example2 on your computer. Select which optional things you want installed."
  23. ; The text to prompt the user to enter a directory
  24. DirText "Choose a directory to install in to:"
  25.  
  26. ; The stuff to install
  27. Section "Example2 (required)"
  28.   ; Set output path to the installation directory.
  29.   SetOutPath $INSTDIR
  30.   ; Put file there
  31.   File "C:\windows\notepad.exe"
  32.   ; Write the installation path into the registry
  33.   WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
  34.   ; Write the uninstall keys for Windows
  35.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2 (remove only)"
  36.   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
  37. SectionEnd
  38.  
  39. ; optional section
  40. Section "Start Menu Shortcuts"
  41.   CreateDirectory "$SMPROGRAMS\Example2"
  42.   CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  43.   CreateShortCut "$SMPROGRAMS\Example2\Example2 (notepad).lnk" "$INSTDIR\notepad.exe" "" "$INSTDIR\notepad.exe" 0
  44. SectionEnd
  45.  
  46. ; uninstall stuff
  47.  
  48. UninstallText "This will uninstall example2. Hit next to continue."
  49. UninstallExeName "uninstall.exe"
  50.  
  51. ; special uninstall section.
  52. Section "Uninstall"
  53.   ; remove registry keys
  54.   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
  55.   DeleteRegKey HKLM SOFTWARE\NSIS_Example2
  56.   ; remove files
  57.   Delete $INSTDIR\notepad.exe
  58.   ; MUST REMOVE UNINSTALLER, too
  59.   Delete $INSTDIR\uninstall.exe
  60.   ; remove shortcuts, if any.
  61.   Delete "$SMPROGRAMS\Example2\*.*"
  62.   ; remove directories used.
  63.   RMDir "$SMPROGRAMS\Example2"
  64.   RMDir "$INSTDIR"
  65. SectionEnd
  66.  
  67. ; eof
  68.