杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1868|回复: 0

NSIS 极点中文脚本

[复制链接]
发表于 2017-2-26 11:04:42 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x


  1. ;极点中文四万词库第四版安装程序
  2. Name "极点中文四万词库(第四版)"
  3. OutFile "..\极点中文四万词库.exe"
  4. AutoCloseWindow true
  5. Icon "setup2.ico"
  6. SetFont "宋体" 9
  7. ShowInstDetails hide
  8. ShowUnInstDetails hide
  9. UninstallIcon "setup1.ico"
  10. WindowIcon on
  11. XPStyle on
  12. CRCCheck on
  13. DirShow show
  14. BGGradient off
  15. var aipc
  16. SilentUnInstall silent
  17. LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"

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


  25. Function .onInit

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

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

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

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

  43. FunctionEnd

  44. Function un.onInit

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

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

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

  56. IfFileExists $INSTDIR\freewb.aipc other no1

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

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

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

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

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

  85. ok:

  86. FunctionEnd


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

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

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


  97. ; 安装页面
  98. Page license
  99. ;Page directory
  100. Page Components
  101. Page instfiles

  102. InstallColors FF0000 fdfdfd
  103. InstProgressFlags smooth colored
  104. InstallDir $INSTDIR

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

  111. #安装选项
  112. InstType "全部安装"
  113. InstType "五笔词库"
  114. InstType "拼音词库"

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

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

  123. SectionEnd

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

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

  132. SetOutPath "$INSTDIR"
  133. File "freewb.mb"

  134. SectionEnd

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

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

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

  143. SetOutPath "$INSTDIR"

  144. File "attach.mb"

  145. SectionEnd

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

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


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


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

  164. SectionEnd

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


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

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

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

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

  186. #delete the skin section

  187. ;Delete "$INSTDIR\freewb.aipc"
  188. ;Delete "$INSTDIR\attach.aipc"
  189. Delete "$INSTDIR\readme.txt"
  190. Delete "$INSTDIR\Restore.exe"
  191. RMDir "$INSTDIR"

  192. SectionEnd ; end of uninstall section

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

  196. ; eof
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 11:44 , Processed in 0.104231 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表