杉宫竹苑工作室

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

NSIS 修复卸载按钮

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

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

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

x
4550324473505230087.jpg
  1. ;NSI源码脚本
  2. SetCompressor /SOLID lzma
  3. SetCompressorDictSize 32

  4. !include "MUI.nsh"
  5. !include "logiclib.nsh"
  6. !include "WinMessages.nsh"

  7. !define MUI_ABORTWARNING
  8. !define MUI_ICON "nod32.ico"
  9. !define MUI_HEADERIMAGE
  10. !define MUI_HEADERIMAGE_BITMAP "header.bmp"
  11. !define MUI_HEADERIMAGE_RIGHT

  12. page custom io1 leave
  13. page custom io2
  14. !insertmacro MUI_PAGE_INSTFILES

  15. !insertmacro MUI_LANGUAGE "SimpChinese"

  16. !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
  17. ReserveFile "io1.ini"
  18. ReserveFile "header.bmp"
  19. ReserveFile "io2.ini"
  20. ReserveFile "fix.ico"
  21. ReserveFile "del.ico"

  22. OutFile "NodSet.exe"
  23. InstallDir "$EXEDIR"
  24. Caption "ESET NOD32 Antivirus 安装/卸载"
  25. BrandingText "ESET NOD32 Antivirus 3.0.659.0"

  26. Section
  27. !insertmacro MUI_INSTALLOPTIONS_READ $0 "io1.ini" "Settings" "Check"
  28. StrCmp $0 "fix" 0 +3
  29. Call inst
  30. Quit
  31. StrCmp $0 "del" 0 +3
  32. Call uninst
  33. Quit
  34. SectionEnd

  35. Function .onInit
  36. ;IfFileExists "$EXEDIRegui.exe" +3
  37. ;  MessageBox MB_OK|MB_ICONEXCLAMATION "请把本程序放在NOD32安装目录下运行!"
  38. ;  Quit
  39.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "io1.ini"
  40.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "io2.ini"
  41.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "fix.ico"
  42.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "del.ico"
  43.   !insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Field 1" "Text" "$PLUGINSDIR ix.ico"
  44.   !insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Field 3" "Text" "$PLUGINSDIRdel.ico"
  45. FunctionEnd

  46. Function io1
  47.   Push $R1
  48.   Push $R2
  49. !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "io1.ini"
  50. GetDlgItem $R1 $HWNDPARENT 1
  51. ShowWindow $R1 ${SW_HIDE}
  52. !insertmacro MUI_INSTALLOPTIONS_READ $R1 "io1.ini" "Field 5" "HWND"
  53. CreateFont $R2 "$(^Font)" "$(^FontSize)" "700"
  54. SendMessage $R1 ${WM_SETFONT} $R2 0
  55. !insertmacro MUI_INSTALLOPTIONS_READ $R1 "io1.ini" "Field 7" "HWND"
  56. SendMessage $R1 ${WM_SETFONT} $R2 0
  57. !insertmacro MUI_HEADER_TEXT "修改、修复或删除安装" "选择您想执行的操作。"
  58. !insertmacro MUI_INSTALLOPTIONS_SHOW
  59.   Pop $R2
  60.   Pop $R1
  61. FunctionEnd

  62. Function leave
  63. !insertmacro MUI_INSTALLOPTIONS_READ $0 "io1.ini" "Settings" "State"
  64. ${Switch} $0
  65. ${Default}
  66. Abort
  67. ${Case} 2
  68.     !insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Settings" "Check" "fix"
  69.     !insertmacro MUI_INSTALLOPTIONS_WRITE "io2.ini" "Field 1" "Text" "单击“修复”来修复 ESET NOD32 Antivirus的安装。如果您想复查或更改您的安装设置,请单击“上一步”。单击“取消”可退出向导。"
  70.     Goto skip
  71.     ${Case} 4
  72.     !insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Settings" "Check" "del"
  73.     !insertmacro MUI_INSTALLOPTIONS_WRITE "io2.ini" "Field 1" "Text" "单击“删除”来从您的计算机删除 ESET NOD32 Antivirus。如果您想复查或更改您的安装设置,请单击“上一步”。单击“取消”可退出向导。"
  74. skip:
  75.     ${Case} 0
  76. ${EndSwitch}
  77. FunctionEnd

  78. !macro MY_INSTALLOPTIONS str ht1 ht2
  79. !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "io2.ini"
  80. GetDlgItem $R1 $HWNDPARENT 1
  81. SendMessage $R1 ${WM_SETTEXT} 0 "STR:${str}"
  82. !insertmacro MUI_HEADER_TEXT "${ht1}" "${ht2}"
  83. !insertmacro MUI_INSTALLOPTIONS_SHOW
  84. !macroend

  85. Function io2
  86. GetDlgItem $R1 $HWNDPARENT 1
  87. ShowWindow $R1 ${SW_SHOW}
  88. !insertmacro MUI_INSTALLOPTIONS_READ $0 "io1.ini" "Settings" "Check"
  89. StrCmp $0 "fix" 0 +2
  90. !insertmacro MY_INSTALLOPTIONS "修复(&R)" "修复 ESET NOD32 Antivirus" "安装向导准备开始修复 ESET NOD32 Antivirus。"
  91. StrCmp $0 "del" 0 +2
  92. !insertmacro MY_INSTALLOPTIONS "删除(&R)" "删除 ESET NOD32 Antivirus" "您已选择从您的计算机删除程序。"
  93. FunctionEnd

  94. Function inst
  95. ;在这里放上绿化的代码
  96. ;....................
  97. HideWindow
  98. MessageBox MB_OK|MB_ICONINFORMATION "NOD32 已修复成功!"
  99. Return
  100. FunctionEnd

  101. Function uninst
  102. ;在这里放上卸载的代码
  103. ;....................
  104. HideWindow
  105. MessageBox MB_OK|MB_ICONINFORMATION "NOD32 已卸载成功!"
  106. Return
  107. FunctionEnd

复制代码

  1. ;IO1.INI配置文件

  2. [Settings]
  3. NumFields=8

  4. [Field 1]
  5. Type=Icon
  6. Left=35
  7. Right=64
  8. Top=30
  9. Bottom=56
  10. Flags=GROUP

  11. [Field 2]
  12. Type=Button
  13. Left=26
  14. Right=63
  15. Top=21
  16. Bottom=58
  17. Flags=GROUP|NOTIFY
  18. Text=&P

  19. [Field 3]
  20. Type=Icon
  21. Left=35
  22. Right=64
  23. Top=75
  24. Bottom=99
  25. Flags=GROUP

  26. [Field 4]
  27. Type=Button
  28. Left=26
  29. Right=63
  30. Top=68
  31. Bottom=104
  32. Flags=GROUP|NOTIFY
  33. Text=&R

  34. [Field 5]
  35. Type=Label
  36. Text=修复(&P)
  37. Left=76
  38. Right=-4
  39. Top=25
  40. Bottom=40
  41. Flags=GROUP

  42. [Field 6]
  43. Type=Label
  44. Text=修复最近的安装状态中的错误 - 修正丢失或损坏的文件、快捷方式和注册表项目。
  45. Left=76
  46. Right=-1
  47. Top=36
  48. Bottom=56

  49. [Field 7]
  50. Type=Label
  51. Text=删除(&R)
  52. Left=76
  53. Right=-1
  54. Top=73
  55. Bottom=81
  56. Flags=GROUP

  57. [Field 8]
  58. Type=Label
  59. Text=从您的计算机删除 ESET NOD32 Antivirus。
  60. Left=76
  61. Right=-1
  62. Top=84
  63. Bottom=95

  64. ;IO2.INI配置文件
  65. [Settings]
  66. NumFields=1

  67. [Field 1]
  68. Type=Label
  69. Left=0
  70. Right=-1
  71. Top=14
  72. Bottom=38
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 16:22 , Processed in 0.128221 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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