脚本:极点中文6.5标准版

优质
小牛编辑
132浏览
2023-12-01
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "极点中文"
!define PRODUCT_VERSION "6.5 标准版"
!define PRODUCT_PUBLISHER "杜志民"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\registry.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

SetCompressor /SOLID lzma
SetCompressorDictSize 64

!macro delDir fileDir
 IfFileExists ${fileDir} 0 +2
  RMDir /r ${fileDir}
!macroend

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
!define MUI_WELCOMEPAGE_TEXT "\r\n    极点中文平台是以86版五笔为主的优秀输入法,可以运行在98/2000/xp/2003/vista操作系统中,支持Unicode及其它输入法挂载\r\n\r\n\r\n\n\n  $_CLICK"
!define MUI_LICENSEPAGE_TEXT_TOP "【极点五笔受权协议】"
!define MUI_LICENSEPAGE_TEXT_BOTTOM "您必须接受本协议才能安装“freeime 6.5标准版”,如不同意请按“取消(&C)”。"
!define MUI_DIRECTORYPAGE_TEXT_TOP "极点五笔将安装在下列文件夹。单击 [浏览(&B)] 可选择其他的文件夹。$\n$\n$_CLICK"
!define MUI_COMPONENTSPAGE_TEXT_TOP "请勾选您想要安装的组件。然后$_CLICK"
!define MUI_FINISHPAGE_RUN_TEXT "查看极点帮助"
!define MUI_FINISHPAGE_RUN "$WINDIR\hh.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "$INSTDIR\freeime.chm"
!define MUI_FINISHPAGE_RUN_NOTCHECKED

; License page
!insertmacro MUI_PAGE_LICENSE "freewb.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; 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 "SimpChinese"
;文件版本声明
  VIProductVersion "6.5.0.0"
  VIAddVersionKey /LANG=2052 "ProductName" "极点中文"
  VIAddVersionKey /LANG=2052 "Comments" "免费使用,版权归杜志民"
  VIAddVersionKey /LANG=2052 "CompanyName" "http://www.freewb.org"
  VIAddVersionKey /LANG=2052 "LegalTrademarks" "freewb"
  VIAddVersionKey /LANG=2052 "LegalCopyright" "杜志民"
  VIAddVersionKey /LANG=2052 "FileDescription" "极点五笔标准版"
  VIAddVersionKey /LANG=2052 "FileVersion" "6.5"

; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "FreewbLE.exe"
InstallDir "$PROGRAMFILES\freeime"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
BrandingText "主页-http://www.freewb.org"
ShowInstDetails hide
ShowUnInstDetails show

InstType "典型安装"

SectionGroup /e "极点中文" SI01
 Section "主程序"
  SectionIn 1 RO
  SetOutPath $INSTDIR
  SetOverwrite try
  File /r freeime\*.*
  WriteINIStr $INSTDIR\conf\default.ini "System" "SkinScheme" "_default"
  WriteRegStr HKCU "Keyboard Layout\Toggle" "Hotkey" "2"
  WriteRegStr HKCU "Keyboard Layout\Toggle" "Language Hotkey" "2"
  WriteRegStr HKCU "Keyboard Layout\Toggle" "Layout Hotkey" "1"
  CreateDirectory "$SMPROGRAMS\极点中文"
  CreateShortCut "$SMPROGRAMS\极点中文\帮助.lnk" "$INSTDIR\freeime.chm"
  CreateShortCut "$SMPROGRAMS\极点中文\极点目录.lnk" "$INSTDIR\" "" "" 0
  ExecWait '"$INSTDIR\registry.exe" /s'
 SectionEnd

 SectionGroup /e "皮肤" SI03
  Section "太空兰"
   SectionIn 1
   SetOutPath $INSTDIR\skin
   File /r "skin\blueness"
   !insertmacro delDir $INSTDIR\skin\_default
   WriteINIStr $INSTDIR\conf\default.ini "System" "SkinScheme" "blueness"
  SectionEnd

  Section "小狐狸"
   SectionIn 1
   SetOutPath $INSTDIR\skin
   File /r "skin\fox"
   !insertmacro delDir $INSTDIR\skin\_default
   WriteINIStr $INSTDIR\conf\default.ini "System" "SkinScheme" "fox"
  SectionEnd

  Section "日月星辰"
   SectionIn 1
   SetOutPath $INSTDIR\skin
   File /r "skin\quan_ry"
   !insertmacro delDir $INSTDIR\skin\_default
   WriteINIStr $INSTDIR\conf\default.ini "System" "SkinScheme" "quan_ry"
  SectionEnd
 SectionGroupEnd
SectionGroupEnd

Section -AdditionalIcons
  SetOutPath $INSTDIR
  CreateShortCut "$SMPROGRAMS\极点中文\卸载.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\registry.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\registry.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
; Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SI01} "极点主程序,支持五笔,拼音混合输入"
!insertmacro MUI_FUNCTION_DESCRIPTION_END

Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2
  Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\uninst.exe"

  RMDir /r "$SMPROGRAMS\极点中文"
  ExecWait '"$INSTDIR\registry.exe" /u /p /s'
  !insertmacro delDir $INSTDIR\conf
  !insertmacro delDir $INSTDIR\plugin
  !insertmacro delDir $INSTDIR\skin
  !insertmacro delDir $INSTDIR\sound

  MessageBox MB_ICONQuESTION|MB_YESNO "是否要保留用户词库?" IDYES keep IDNO none
  keep:
    Delete "$INSTDIR\freeime.bex"
    Delete "$INSTDIR\freeime.bin"
    Delete "$INSTDIR\freeime.chm"
    Delete "$INSTDIR\freeime.dll"
    Delete "$INSTDIR\freeime.ime"
    Delete "$INSTDIR\registry.exe"
    Delete "$INSTDIR\symbol.txt"
    Goto finsh
  none:
    RMDir /r $INSTDIR
  finsh:
    Delete /REBOOTOK "$SYSDIR\freeime.ime"
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true
SectionEnd