1 ; namefix.pl.nsi 2 3 ;-------------------------------- 4 5 Name "Namefix.pl" 6 OutFile "namefix.pl_install.exe" 7 8 ; The default installation directory 9 InstallDir $PROGRAMFILES\namefix.pl 10 11 ; Registry key to check for directory (so if you install again, it will 12 ; overwrite the old one automatically) 13 InstallDirRegKey HKLM "Software\NSIS_namefix.pl" "Install_Dir" 14 15 ; Request application privileges for Windows Vista 16 RequestExecutionLevel admin 17 18 !include "EnvVarUpdate.nsh" 19 20 ;-------------------------------- 21 22 ; Pages 23 24 Page components 25 Page directory 26 Page instfiles 27 28 UninstPage uninstConfirm 29 UninstPage instfiles 30 31 ;-------------------------------- 32 33 ; The stuff to install 34 Section "namefix.pl (required)" 35 36 InitPluginsDir 37 SectionIn RO 38 39 ; Set output path to the installation directory. 40 SetOutPath $INSTDIR 41 42 ; Put file there 43 File /r "..\" 44 45 ; Write the installation path into the registry 46 WriteRegStr HKLM SOFTWARE\NSIS_namefix.pl "Install_Dir" "$INSTDIR" 47 48 ; Write the uninstall keys for Windows 49 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\namefix.pl" "DisplayName" "NSIS namefix.pl" 50 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\namefix.pl" "UninstallString" '"$INSTDIR\uninstall.exe"' 51 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\namefix.pl" "NoModify" 1 52 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\namefix.pl" "NoRepair" 1 53 WriteUninstaller "uninstall.exe" 54 55 SectionEnd 56 57 Section "Add namefix.pl to explorer right click menu" 58 ; add explorer intergration 59 WriteRegStr HKEY_CLASSES_ROOT "Directory\shell\namefix" "" "namefix.pl" 60 WriteRegStr HKEY_CLASSES_ROOT "Directory\shell\namefix\command" "" "$\"$INSTDIR\namefix-gui.exe$\" $\"%1$\"" 61 SectionEnd 62 63 Section "Add namefix.pl to system path" 64 ${EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR" ; Remove path of old install 65 ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR" ; add path 66 SectionEnd 67 68 ; Optional section (can be disabled by the user) 69 Section "Start Menu Shortcuts" 70 71 CreateDirectory "$SMPROGRAMS\namefix.pl" 72 CreateShortCut "$SMPROGRAMS\namefix.pl\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 73 CreateShortCut "$SMPROGRAMS\namefix.pl\namefix.pl.lnk" "$INSTDIR\namefix-gui.exe" "" "$INSTDIR\namefix-gui.exe" 0 74 75 SectionEnd 76 77 ;-------------------------------- 78 79 ; Uninstaller 80 81 Section "Uninstall" 82 83 ; Remove registry keys 84 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\namefix.pl" 85 DeleteRegKey HKLM SOFTWARE\NSIS_namefix.pl 86 DeleteRegKey HKEY_CLASSES_ROOT "Directory\shell\namefix" 87 88 ; Remove files and uninstaller 89 Delete $INSTDIR\namefix.exe 90 Delete $INSTDIR\namefix-gui.exe 91 Delete $INSTDIR\uninstall.exe 92 93 ; Remove shortcuts, if any 94 Delete "$SMPROGRAMS\namefix.pl\*.*" 95 96 ; Remove directories used 97 RMDir "$SMPROGRAMS\namefix.pl" 98 RMDir "$INSTDIR" 99 100 ; remove from system path 101 ${un.EnvVarUpdate} $0 "LIB" "R" "HKLM" "$INSTDIR" 102 103 SectionEnd