; SweeperBot installer by Peter Sinnott ; Based on NSISC Modern User Interface basic example by Joost Verburg !include "MUI.nsh" Name "SweeperBot" OutFile "SweeperBotInstall.exe" InstallDir "$PROGRAMFILES\SweeperBot" InstallDirRegKey HKCU "Software\SweeperBot" "dir" !define MUI_ICON "favicon.ico" !define MUI_UNICON "favicon.ico" !define MUI_ABORTWARNING ;-------------------------------- ;Pages !insertmacro MUI_PAGE_LICENSE "License.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Installer Sections Section "SweeperBot" SweeperBot ;StrCpy $0 "SweeperBot.exe" ;KillProc::KillProcesses IfFileExists "$INSTDIR/Uninstall.exe" 0 +3 MessageBox MB_OK "A version of SweeperBot is already installed, it needs to be uninstalled first" EXecWait '"$INSTDIR/Uninstall.exe" _?=$INSTDIR' SetOutPath "$INSTDIR" File SweeperBot.exe CreateDirectory "$SMPROGRAMS\SweeperBot" CreateShortCut "$SMPROGRAMS\SweeperBot\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\SweeperBot\SweeperBot.lnk" "$INSTDIR\SweeperBot.exe" WriteRegStr HKCU "Software\SweeperBot" "dir" $INSTDIR WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product" "DisplayName" "SweeperBot" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product" "UninstallString" "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;StrCpy $0 "SweeperBot.exe" ;KillProc::KillProcesses Delete "$INSTDIR\SweeperBot.exe" Delete "$INSTDIR\Uninstall.exe" delete "$SMPROGRAMS\SweeperBot\SweeperBot.lnk" delete "$SMPROGRAMS\SweeperBot\Uninstall.lnk" rmdir $SMPROGRAMS\SweeperBot" RMDir "$INSTDIR" SectionEnd