; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Newsletter Tutorial - More Intelligent AI"
!define PRODUCT_VERSION ""
!define PRODUCT_PUBLISHER "Steve Vink, for The Game Creators"
!define PRODUCT_WEB_SITE "http://thegamecreators.com/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "license.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "HUD Tutorial.exe"
InstallDir "$PROGRAMFILES\Dark Basic Professional\Newsletter Tutorials\More Intelligent AI\"
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
  SetOutPath "$INSTDIR"
  CreateDirectory "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\"
  File /r "*.*"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Tutorial.lnk" "$INSTDIR\Dark AI.pdf"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Step 1.lnk" "$INSTDIR\Step 1.dbpro"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Step 2.lnk" "$INSTDIR\Step 2.dbpro"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Step 3.lnk" "$INSTDIR\Step 3.dbpro"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Step 4.lnk" "$INSTDIR\Step 4.dbpro"
SectionEnd

Section -AdditionalIcons
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  CreateShortCut "$SMPROGRAMS\The Game Creators\Newsletter Tutorials\More Intelligent AI\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "More Intelligent AI tutorial was successfully removed from your computer."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove the More Intelligent AI tutorial and all of its components?" IDYES +2
  Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\*.*"

  RMDir "$SMPROGRAMS\Newsletter Tutorial - More Intelligent AI"
  RMDir "$INSTDIR"
  RMDir ""

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  SetAutoClose true
SectionEnd