; Calendar.nsi
;
; 这是我使用的一个小软件的安装文件脚本,其中包含了
; 用户安装目录选择、核心程序组件与快捷方式创建选择、卸载程序
;
; 这是我使用的一个小软件的安装文件脚本,其中包含了
; 用户安装目录选择、核心程序组件与快捷方式创建选择、卸载程序
;--------------------------------
; 安装程序名称,将显示在安装程序对话框标题
Name "日历1900-2100"
Name "日历1900-2100"
; 生成的单个安装执行文件
OutFile "Calendar-Setup.exe"
OutFile "Calendar-Setup.exe"
; 缺省安装目录
InstallDir $PROGRAMFILES/Calendar1900-2100
InstallDir $PROGRAMFILES/Calendar1900-2100
; 写注册表,标示该程序已经安装
InstallDirRegKey HKLM "Software/Calendar1900-2100" "Install_Dir"
InstallDirRegKey HKLM "Software/Calendar1900-2100" "Install_Dir"
;--------------------------------
; 程序窗口
; 安装组件内容选择窗口
Page components
; 安装目录选择窗口
Page directory
; 安装文件
Page instfiles
; 安装目录选择窗口
Page directory
; 安装文件
Page instfiles
; 装载中文界面资源,如果没有这句,缺省为英文界面
LoadLanguageFile "${NSISDIR}/Contrib/Language files/SimpChinese.nlf"
; 卸载程序确认
UninstPage uninstConfirm
; 卸载内容
UninstPage instfiles
; 卸载内容
UninstPage instfiles
;--------------------------------
; 安装内容
Section "日历1900-2100","日历核心组件"
Section "日历1900-2100","日历核心组件"
SectionIn RO
; 设置安装目录.
SetOutPath $INSTDIR
; 要打包安装的文件
File "E:/Rookie/WinASM/Calendar/Release/Calendar.exe"
File "E:/Rookie/WinASM/Calendar/Release/HBlibrary.dll"
File /oname=$SYSDIR/hbhap.dll "E:/Rookie/WinASM/Calendar/Release/hbhap.dll"
File "E:/Rookie/WinASM/Calendar/Release/distributer.txt"
; 写注册表
WriteRegStr HKLM SOFTWARE/Calendar1900-2100 "Install_Dir" "$INSTDIR"
; 写卸载信息
WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "DisplayName" "日历1900-2100"
WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "UninstallString" '"$INSTDIR/uninstall.exe"'
WriteRegDWORD HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "NoModify" 1
WriteRegDWORD HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; 设置安装目录.
SetOutPath $INSTDIR
; 要打包安装的文件
File "E:/Rookie/WinASM/Calendar/Release/Calendar.exe"
File "E:/Rookie/WinASM/Calendar/Release/HBlibrary.dll"
File /oname=$SYSDIR/hbhap.dll "E:/Rookie/WinASM/Calendar/Release/hbhap.dll"
File "E:/Rookie/WinASM/Calendar/Release/distributer.txt"
; 写注册表
WriteRegStr HKLM SOFTWARE/Calendar1900-2100 "Install_Dir" "$INSTDIR"
; 写卸载信息
WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "DisplayName" "日历1900-2100"
WriteRegStr HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "UninstallString" '"$INSTDIR/uninstall.exe"'
WriteRegDWORD HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "NoModify" 1
WriteRegDWORD HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "开始菜单快捷方式"
Section "开始菜单快捷方式"
CreateDirectory "$SMPROGRAMS/Calendar1900-2100"
CreateShortCut "$SMPROGRAMS/Calendar1900-2100/卸载.lnk" "$INSTDIR/uninstall.exe" "" "$INSTDIR/uninstall.exe" 0
CreateShortCut "$SMPROGRAMS/Calendar1900-2100/日历1900-2100.lnk" "$INSTDIR/Calendar.exe" "" "$INSTDIR/Calendar.exe" 0
SectionEnd
CreateShortCut "$SMPROGRAMS/Calendar1900-2100/卸载.lnk" "$INSTDIR/uninstall.exe" "" "$INSTDIR/uninstall.exe" 0
CreateShortCut "$SMPROGRAMS/Calendar1900-2100/日历1900-2100.lnk" "$INSTDIR/Calendar.exe" "" "$INSTDIR/Calendar.exe" 0
SectionEnd
;--------------------------------
; 卸载程序部分
Section "Uninstall"
; 删除注册表项
DeleteRegKey HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100"
DeleteRegKey HKLM SOFTWARE/Calendar1900-2100
; 删除注册表项
DeleteRegKey HKLM "Software/Microsoft/Windows/CurrentVersion/Uninstall/Calendar1900-2100"
DeleteRegKey HKLM SOFTWARE/Calendar1900-2100
; 删除相关文件
Delete $INSTDIR/Calendar.exe
Delete $INSTDIR/distributer.txt
Delete $INSTDIR/HBlibrary.dll
Delete $SYSDIR/hbhap.dll
;Delete $INSTDIR/makensisw.exe
Delete $INSTDIR/uninstall.exe
Delete $INSTDIR/Calendar.exe
Delete $INSTDIR/distributer.txt
Delete $INSTDIR/HBlibrary.dll
Delete $SYSDIR/hbhap.dll
;Delete $INSTDIR/makensisw.exe
Delete $INSTDIR/uninstall.exe
; 删除快捷方式
Delete "$SMPROGRAMS/Calendar1900-2100/*.*"
Delete "$SMPROGRAMS/Calendar1900-2100/*.*"
; 删除程序目录
RMDir "$SMPROGRAMS/Calendar1900-2100"
RMDir "$INSTDIR"
RMDir "$SMPROGRAMS/Calendar1900-2100"
RMDir "$INSTDIR"
SectionEnd