备份NSIS源代码
!define PRODUCT_NAME "loadmaster"
!define PRODUCT_VERSION "4.0"
!define PRODUCT_PUBLISHER "北京达纬恒通信息技术有限公司"
!define PRODUCT_WEB_SITE "http://www.zhuangxiang.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\abc.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define MUI_WELCOMEFINISHPAGE_BITMAP "E:\project\abc\pic.bmp"
!define MUI_WELCOMEPAGE_TITLE "\r\n 装箱大师企业版4.0"
!define MUI_WELCOMEPAGE_TEXT "LoadMaster装箱大师集装箱装箱软件是目前国际市场上集装箱装箱率最高的一套集装箱软件。它致力于为客户提供高度优化的集装箱装箱方案,帮助客户降低货物运输环节的费用。适用于计算货柜装箱、集装箱拼箱、卡车装箱、火车装箱、纸箱装箱、托盘装箱。\
\r\n\r\n\r\n单击[下一步] 继续安装 [取消]将取消安装 "
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\装箱大师新增功能.txt"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "装箱大师新增功能"
SetCompressor lzma
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "project\abc\LTDPIC.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; 语言选择窗口常量设置
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; 欢迎页面
!insertmacro MUI_PAGE_WELCOME
;LicenseLangString license ${LANG_ENGLISH} "e:\englishlicence.txt"
;LicenseLangString license ${LANG_SIMPCHINESE} E:\SoftwareLicence.txt
;LicenseLangString license ${LANG_TRADCHINESE} license-tradchinese.txt
;LicenseData $(license)
; 许可协议页面
!insertmacro MUI_PAGE_LICENSE "E:\SoftwareLicence2.txt"
;LicenseData "e:\englishlicence.txt"
;LicenseData /LANG=1028 "e:\englishlicence.txt"
;LicenseData ${LANG_TRADCHINESE} "e:\englishlicence.txt"
;LicenseData "$(license)"
;LicenseLangString license ${LANG_ENGLISH} E:\englishlicence.txt
;LicenseLangString license ${LANG_SIMPCHINESE} E:\SoftwareLicence.txt
;LicenseData /LANG=1028 "E:\SoftwareLicence.txt"
;!insertmacro MUI_RESERVEFILE_LANGDLL
; 安装目录选择页面
!insertmacro MUI_PAGE_DIRECTORY
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
!define MUI_FINISHPAGE_RUN "$INSTDIR\abc.exe"
!insertmacro MUI_PAGE_FINISH
; 安装卸载过程页面
!insertmacro MUI_UNPAGE_INSTFILES
; 安装界面包含的语言设置
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
; 安装预释放文件
!insertmacro MUI_RESERVEFILE_LANGDLL
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
Section "选择语言" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
;Create uninstaller
; WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
;!insertmacro MUI_LANGDLL_DISPLAY
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
push "English"
push ${LANG_TRADCHINESE}
Push "Traditional Chinese"
Push ${LANG_SIMPCHINESE}
Push "Simplified Chinese"
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select a language 请选择语言"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
FunctionEnd
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "loadmaster.exe"
InstallDir "$PROGRAMFILES\loasmaster"
InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
ShowInstDetails show
ShowUnInstDetails show
BrandingText "装箱大师竭诚为您服务 http://www.zhuangxiang.com/"
Section "主程序" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "project\abc\abc\obj\Debug\abc.exe"
CreateDirectory "$SMPROGRAMS\装箱大师99"
createdirectory "$INSTDIR\g8"
CopyFiles e:\dd.xls $INSTDIR\g8 ;拷贝文件,成功,嘿嘿
CreateShortCut "$SMPROGRAMS\装箱大师99\loasmaster.lnk" "$INSTDIR\abc.exe"
CreateShortCut "$DESKTOP\loasmaster.lnk" "$INSTDIR\abc.exe"
File "SoftwareLicence.TXT"
File "11.xls"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\装箱大师99\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\装箱大师99\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\abc.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}" "DisplayIcon" "$INSTDIR\abc.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
/******************************
* 以下是安装程序的卸载部分 *
******************************/
Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\11.xls"
Delete "$INSTDIR\SoftwareLicence.TXT"
Delete "$INSTDIR\abc.exe"
Delete "$SMPROGRAMS\装箱大师99\Uninstall.lnk"
Delete "$SMPROGRAMS\装箱大师99\Website.lnk"
Delete "$DESKTOP\loasmaster.lnk"
Delete "$SMPROGRAMS\装箱大师99\loasmaster.lnk"
RMDir "$SMPROGRAMS\装箱大师99"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
#-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--#
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "您确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2
Abort
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从您的计算机移除。"
FunctionEnd