• NSIS 第一个安装程序


    !define PRODUCT_NAME "装箱大师企业版"
    !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\ProductActivation.exe"
    !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
    !define PRODUCT_UNINST_ROOT_KEY "HKLM"
    !define MUI_WELCOMEFINISHPAGE_BITMAP "F:\workspace\pic.bmp"
    !define MUI_WELCOMEPAGE_TITLE "\r\n       装箱大师企业版4.0"
    !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\装箱大师新增功能.txt"
    !define MUI_FINISHPAGE_SHOWREADME_TEXT "查看 装箱大师新增功能"

    SetCompressor lzma
    !include "MUI.nsh"

    !define MUI_ABORTWARNING
    !define MUI_ICON "F:\workspace2\GEARS.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
    !insertmacro MUI_PAGE_LICENSE "e:\SoftwareLicence.txt"
    !insertmacro MUI_PAGE_COMPONENTS

    !insertmacro MUI_PAGE_DIRECTORY

    !insertmacro MUI_PAGE_INSTFILES

    !define MUI_FINISHPAGE_RUN "$INSTDIR\LoadMasterMain.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


    Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    OutFile "LoadMaster_Setup.exe"
    InstallDir "$PROGRAMFILES\装箱大师企业版"
    InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
    ShowInstDetails show
    ShowUnInstDetails show
    BrandingText "装箱大师竭诚为您服务  http://www.zhuangxiang.com/"

    Section "-MainSection" SEC01
      SetOutPath "$INSTDIR"
      SetOverwrite ifnewer
      File "F:\workspace2\RenderSystem_GL.dll"
      CreateDirectory "$SMPROGRAMS\装箱大师企业版"
      CreateShortCut "$SMPROGRAMS\装箱大师企业版\装箱大师企业版4.0.lnk" "$INSTDIR\LoadMasterMain.exe"
      CreateShortCut "$DESKTOP\装箱大师企业版4.0.lnk" "$INSTDIR\LoadMasterMain.exe"
      CreateShortCut "$SMPROGRAMS\装箱大师企业版\Help.lnk" "$INSTDIR\Manual.chm"
      File "F:\workspace2\RenderSystem_Direct3D9.dll"
      File "F:\workspace2\ProductActivation.vshost.exe.config"
      File "F:\workspace2\ProductActivation.pdb"
      File "F:\workspace2\ProductActivation.exe.config"
      File "F:\workspace2\ProductActivation.exe"
      File "F:\workspace2\plugins.cfg"
      File "F:\workspace2\Plugin_ParticleFX.dll"
      File "F:\workspace2\Plugin_OctreeSceneManager.dll"
      File "F:\workspace2\Plugin_CgProgramManager.dll"
      File "F:\workspace2\Plugin_BSPSceneManager.dll"
      File "F:\workspace2\OIS.dll"
      File "F:\workspace2\OgreMain.dll"
      File "F:\workspace2\Ogre.log"
      File "F:\workspace2\MOIS.dll"
      File "F:\workspace2\Mogre.dll"
      File "F:\workspace2\Manual.chm"
      File "F:\workspace2\LoadMasterMain.exe.config"
      File "F:\workspace2\LoadMasterMain.exe"
      File "F:\workspace2\InitMogre.dll"
      File "F:\workspace2\HID.exe"
      File "F:\workspace2\GEARS.ico"
      File "F:\workspace2\database.mdb"
      File "F:\workspace2\Csla.dll"
      File "F:\workspace2\csgl.native.dll"
      File "F:\workspace2\csgl.dll"
      File "F:\workspace2\cg.dll"
      File "F:\workspace2\resources.cfg"
     file "F:\workspace2\装箱大师新增功能.txt"
     
    SectionEnd

    Section   "简体中文界面"  SEC02
      File "F:\workspace2\templet.zh-CN.xls"
    ;  CreateDirectory  $INSTDIR\zh-CN
    ;  File /oname=zh-CN
      setoutpath  $INSTDIR\zh-CN
      File /r "f:\workspace2\zh-CN\*.*"
    SectionEnd

    Section /o "繁体中文界面" SEC03
      File "F:\workspace2\templet.zh-CHN.xls"
      setoutpath $INSTDIR\zh-HK
      file  /r   "f:\workspace2\zh-HK\*.*"
    SectionEnd

    Section /o  "English interface" SEC04
     File "F:\workspace2\templet.xls"
    SectionEnd

    Section -AdditionalIcons
      WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
      CreateShortCut "$SMPROGRAMS\装箱大师企业版\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
      CreateShortCut "$SMPROGRAMS\装箱大师企业版\Uninstall.lnk" "$INSTDIR\uninst.exe"
    SectionEnd

    Section -Post
      WriteUninstaller "$INSTDIR\uninst.exe"
      WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ProductActivation.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\ProductActivation.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

    ; 区段组件描述
    !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
      !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "主程序 Main program"
      !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "运行软件后,软件语言是简体中文界面"
      !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "運行軟件後,軟件語言是繁體中文界面"
      !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "After running the software, the software is the English language interface"
    !insertmacro MUI_FUNCTION_DESCRIPTION_END

    Function .onInit
      strcpy $1  ${SEC02}
      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

    Function .onSelChange

      !insertmacro StartRadioButtons $1
        !insertmacro RadioButton ${SEC02}
        !insertmacro RadioButton ${SEC03}
        !insertmacro RadioButton ${SEC04}
      !insertmacro EndRadioButtons
    Functionend

    Section Uninstall
      Delete "$INSTDIR\${PRODUCT_NAME}.url"
      Delete "$INSTDIR\uninst.exe"
      Delete "$INSTDIR\templet.zh-CHN.xls"
      Delete "$INSTDIR\templet.zh-CN.xls"
      Delete "$INSTDIR\templet.xls"
      Delete "$INSTDIR\resources.cfg"
      Delete "$INSTDIR\cg.dll"
      Delete "$INSTDIR\csgl.dll"
      Delete "$INSTDIR\csgl.native.dll"
      Delete "$INSTDIR\Csla.dll"
      Delete "$INSTDIR\database.mdb"
      Delete "$INSTDIR\GEARS.ico"
      Delete "$INSTDIR\HID.exe"
      Delete "$INSTDIR\InitMogre.dll"
      Delete "$INSTDIR\LoadMasterMain.exe"
      Delete "$INSTDIR\LoadMasterMain.exe.config"
      Delete "$INSTDIR\Manual.chm"
      Delete "$INSTDIR\Mogre.dll"
      Delete "$INSTDIR\MOIS.dll"
      Delete "$INSTDIR\Ogre.log"
      Delete "$INSTDIR\OgreMain.dll"
      Delete "$INSTDIR\OIS.dll"
      Delete "$INSTDIR\Plugin_BSPSceneManager.dll"
      Delete "$INSTDIR\Plugin_CgProgramManager.dll"
      Delete "$INSTDIR\Plugin_OctreeSceneManager.dll"
      Delete "$INSTDIR\Plugin_ParticleFX.dll"
      Delete "$INSTDIR\plugins.cfg"
      Delete "$INSTDIR\ProductActivation.exe"
      Delete "$INSTDIR\ProductActivation.exe.config"
      Delete "$INSTDIR\ProductActivation.pdb"
      Delete "$INSTDIR\ProductActivation.vshost.exe.config"
      Delete "$INSTDIR\RenderSystem_Direct3D9.dll"
      Delete "$INSTDIR\RenderSystem_GL.dll"

      Delete "$SMPROGRAMS\装箱大师企业版\Uninstall.lnk"
      Delete "$SMPROGRAMS\装箱大师企业版\Website.lnk"
      Delete "$SMPROGRAMS\装箱大师企业版\Help.lnk"
      Delete "$DESKTOP\装箱大师企业版4.0.lnk"
      Delete "$SMPROGRAMS\装箱大师企业版\装箱大师企业版4.0.lnk"

      RMDir "$SMPROGRAMS\装箱大师企业版"

      RMDir "$INSTDIR"
     
      RMDir /r "$INSTDIR"

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


    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

  • 相关阅读:
    ans_rproxy 说明
    ubuntu adduser
    linux 修改 elf 文件的dynamic linker 和 rpath
    What Is The Promiscuous Mode
    gpart 分区工具
    TortoiseSVN的基本使用方法
    svn和git的区别及适用场景
    TortoiseSVN 和 VisualSVN Server 使用教程
    SVN中trunk、branches、tag的使用
    C/C++中substr函数的应用(简单讲解)
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/1295992.html
Copyright © 2020-2023  润新知