脚本:极点中文四万词库

优质
小牛编辑
132浏览
2023-12-01
;制作:·aipc·
;极点中文四万词库第四版安装程序

Name "极点中文四万词库(第四版)"
OutFile "..\极点中文四万词库.exe"
AutoCloseWindow true
Icon "setup2.ico"
SetFont "宋体" 9
ShowInstDetails hide
ShowUnInstDetails hide
UninstallIcon "setup1.ico"
WindowIcon on
XPStyle on
CRCCheck on
DirShow show
BGGradient off
var aipc
SilentUnInstall silent
LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"

Caption "极点中文四万词库(第四版)"
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
SubCaption 3 " "
SubCaption 4 " "
BrandingText /TRIMRIGHT "与所有极点爱好者共享!"


Function .onInit

; MessageBox MB_YESNO "即将安装极点中文四万词库,是否继续?" IDYES gogogo
; Abort
;gogog

FindWindow $R0 "JDCLASS_UI"
intcmp 0 $R0 NoAbort ExitNow ExitNow
ExitNow:
MessageBox MB_OK "极点中文正在使用,请注销或重启计算机后再试。"
Abort ; causes installer to quit.
NoAbort:

ReadRegStr $INSTDIR HKLM "SOFTWARE\极点中文" "系统目录"
;MessageBox MB_OK $INSTDIR

StrCmp "" $INSTDIR nDefault Over
nDefault:
;StrCpy $INSTDIR "$PROGRAMFILES\JDZW"
MessageBox MB_OK "极点中文没有安装或版本太低,请安装极点中文最新版。"
Abort
Over:

FunctionEnd

Function un.onInit

ReadRegStr $aipc HKLM "SOFTWARE\极点中文" "系统目录"

FindWindow $R0 "JDCLASS_UI"
intcmp 0 $R0 NoAbort ExitNow ExitNow
ExitNow:
MessageBox MB_OK "极点中文正在使用,请注销或重启计算机后再试。"
Abort ; causes installer to quit.
NoAbort:

;检测恢复文件是否存在
MessageBox MB_YESNO "恢复极点中文原词库,四万词库将被删除,是否继续?" IDYES gogogogo
Abort
gogogog

IfFileExists $INSTDIR\freewb.aipc other no1
other:
IfFileExists $INSTDIR\attach.aipc delpy1
MessageBox MB_YESNO "拼音词库无法恢复:您没有安装拼音词库或文件被破坏。$\n想尝试恢复五笔词库吗?" IDYES go
Abort
g
Delete "$aipc\freewb.mb"
MessageBox MB_OK "五笔词库恢复成功,·aipc·感谢您的关注,再见。"
goto ok

no1:
MessageBox MB_YESNO "五笔词库无法恢复:您没有安装五笔词库或文件被破坏。$\n想尝试恢复拼音词库吗?" IDYES gogo
abort

gog
IfFileExists $INSTDIR\attach.aipc delpy2
MessageBox MB_OK "哇噻,拼音词库也无法恢复了吔:原因同上。"
MessageBox MB_YESNO "原词库无法再恢复了,但还可以清除安装极点中文四万词$\n库时遗留在注册表里的信息,您是否要清除这些信息?" IDYES gogogo
Abort
gogog
MessageBox MB_OK "清理成功,·aipc·感谢您的关注,再见。"
goto ok

delpy1:
Delete "$aipc\attach.mb"
Delete "$aipc\freewb.mb"
MessageBox MB_OK "五笔与拼音词库全部恢复成功,·aipc·感谢您的关注,再见。"
goto ok

delpy2:
Delete "$aipc\attach.mb"
MessageBox MB_OK "拼音词库恢复成功,·aipc·感谢您的关注,再见。"
goto ok

ok:

FunctionEnd
LicenseText "安装之前请认真阅读使用说明。本词库仅适用于极点中文。您可以自由传播,但请勿重新打包后再发布。"
;LicenseBkColor fdfdfd
LicenseData "license.rtf"
ComponentText "勾选你想要安装的组件,并解除勾选你不希望安装的组件。单击[安装(I)]开始安装进程。" "·aipc·推荐您全部安装:" "根据您的需要,对安装项目进行选择:"
CompletedText "您随时都可以在“控制面板→添加/删除程序”里恢复极点原词库。"
DetailsButtonText "活着真好!"

DirText "$\r$\n欢迎使用·aipc·制作的极点安装程序:"

;Section "-WriteReg"
;WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录" "$INSTDIR"
;SectionEnd


; 安装页面
Page license
;Page directory
Page Components
Page instfiles

InstallColors FF0000 fdfdfd
InstProgressFlags smooth colored
InstallDir $INSTDIR

/*Section "-四万词库"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录" "$INSTDIR"
CreateDirectory "$INSTDIR\四万词库\"
Rename /REBOOTOK $INSTDIR\freewb.mb $INSTDIR\四万词库\freewb.aipc
Rename /REBOOTOK $INSTDIR\attach.mb $INSTDIR\四万词库\attach.aipc
SectionEnd */

#安装选项
InstType "全部安装"
InstType "五笔词库"
InstType "拼音词库"

#主程序安装
Section "-五笔词库《同时备份原五笔词库》" SEC01
SectionIn 1 2 3
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录" "$INSTDIR"

#用户词库,不覆盖
SetOverwrite on
SetOutPath "$INSTDIR\四万词库"
File "ReadME.txt"

SectionEnd

Section "五笔词库《同时备份原五笔词库》" SEC02
SectionIn 1 2
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录" "$INSTDIR"

#用户词库,不覆盖
SetOverwrite on
SetOutPath "$INSTDIR\四万词库"
;File "ReadME.txt"
Rename /REBOOTOK $INSTDIR\freewb.mb $INSTDIR\四万词库\freewb.aipc

SetOutPath "$INSTDIR"
File "freewb.mb"

SectionEnd

Section "拼音词库《同时备份原拼音词库》" SEC03
SectionIn 1 3

WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录" "$INSTDIR"

#用户词库,不覆盖
SetOverwrite on
SetOutPath "$INSTDIR\四万词库"
;File "ReadME.txt"
Rename /REBOOTOK $INSTDIR\attach.mb $INSTDIR\四万词库\attach.aipc

SetOutPath "$INSTDIR"

File "attach.mb"

SectionEnd

Function .onInstSuccess
MessageBox MB_OK "恭喜:安装成功!·aipc·感谢您的关注!"
FunctionEnd

#创建快捷方式段
Section "在开始菜单创建词库恢复《推荐》"
SectionIn 1 2 3
SetOutPath $INSTDIR
CreateDirectory $SMPROGRAMS\极点中文\四万词库
CreateShortCut "$SMPROGRAMS\极点中文\四万词库\四万词库安装目录.lnk" "$INSTDIR\四万词库" ""
CreateShortCut "$SMPROGRAMS\极点中文\四万词库\极点中文四万词库说明.lnk" "$INSTDIR\四万词库\ReadME.txt" ""
# CreateShortCut "$SMPROGRAMS\极点中文\使用说明.lnk" "$INSTDIR\freewb.htm" ""
CreateShortCut "$SMPROGRAMS\极点中文\四万词库\恢复极点中文原词库.lnk" "$INSTDIR\四万词库\Restore.exe" ""
#CreateShortCut "$SMPROGRAMS\极点中文\配置文件.lnk" "$INSTDIR\freewb.ini" ""
SectionEnd


Section "-卸载程序"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\极点中文四万词库" "DisplayName" "恢复极点中文原词库"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\极点中文四万词库" "UninstallString" '"$INSTDIR\四万词库\Restore.exe"'


WriteUninstaller "$INSTDIR\四万词库\Restore.exe"

SectionEnd

UninstallText "本程序将恢复您原来的词库(即把极点中文四万词库删除)" "恢复文件路径:"
UninstallCaption "恢复极点中文原词库 By ·aipc·"
UninstallSubCaption 0 " "
UninstallSubCaption 1 " "
UninstallSubCaption 2 " "
UninstallButtonText "恢复"
;InstallDir $INSTDIR


Section Uninstall
Rmdir /r "$SMPROGRAMS\极点中文\四万词库"
Rmdir "$SMPROGRAMS\极点中文"
#DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\极点中文\系统目录"

#DeleteRegValue HKEY_LOCAL_MACHINE "SOFTWARE\极点中文" "系统目录"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\极点中文四万词库"

;Delete "$INSTDIR\freewb.mb"
;Delete "$INSTDIR\attach.mb"

ReadRegStr $aipc HKLM "SOFTWARE\极点中文" "系统目录"
;CreateDirectory "$aipc"
;Delete "$aipc\freewb.mb"
;Delete "$aipc\attach.mb"
Rename $INSTDIR\freewb.aipc $aipc\freewb.mb
Rename $INSTDIR\attach.aipc $aipc\attach.mb

#delete the skin section

;Delete "$INSTDIR\freewb.aipc"
;Delete "$INSTDIR\attach.aipc"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\Restore.exe"
RMDir "$INSTDIR"

SectionEnd ; end of uninstall section

;Function un.onUninstSuccess
; MessageBox MB_OK "恢复完成,·aipc·感谢您的关注,再见。"
; FunctionEnd

; eof