杉宫竹苑工作室

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

组件跟自定义页面的控制问题

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

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

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

x
现有一安装文件,要做到如下几点:

主选项 (必选) (这部分没有问题)

另外 还有两个选项
A , B , 以及一个自定义页面PageC
1,如果A,B都不选,那么就跳过自定义页面PageC
否则,
将对应的目录选择框设置为 可用/不可用
2,分别选取A,B安装的路径 (不同于主选项的安装路径),并要分别判断A,B路径是否合法,以及路径下是否存在某个特定文件;

  1. Name                "test2"
  2. OutFile              "test2.exe"
  3. SetCompressor        /FINAL /SOLID lzma

  4. !include            MUI.nsh
  5. !define              LOGICLIB_SECTIONCMP
  6. !include            LogicLib.nsh

  7. !insertmacro MUI_PAGE_COMPONENTS
  8. Page custom SetCustom LeaveCustom
  9. !insertmacro MUI_PAGE_INSTFILES

  10. !insertmacro MUI_LANGUAGE SimpChinese

  11. Section A SEC_A
  12. SectionEnd

  13. Section B SEC_B
  14. SectionEnd

  15. Function SetCustom
  16.     ${Unless} ${SectionIsSelected} ${SEC_A}
  17.     ${AndUnless} ${SectionIsSelected} ${SEC_B}
  18.         Abort
  19.     ${EndUnless}
  20.     InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\io.ini"
  21.     InstallOptions::show
  22. FunctionEnd

  23. Function LeaveCustom
  24.     ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 2" State
  25.     ${Unless} ${FileExists} "$0\*"
  26.         MessageBox MB_OK|MB_ICONSTOP "error"
  27.         Abort
  28.     ${EndUnless}
  29.     ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 4" State
  30.     ${Unless} ${FileExists} "$0\*"
  31.         MessageBox MB_OK|MB_ICONSTOP "error"
  32.         Abort
  33.     ${EndUnless}
  34.     ${Unless} ${FileExists} "$WINDIR\explorer.exe"
  35.         MessageBox MB_OK|MB_ICONSTOP "error"
  36.         Abort
  37.     ${EndUnless}
  38. FunctionEnd

  39. ReserveFile test2.ini

  40. Function .onInit
  41.     InitPluginsDir
  42.     File /oname=$PLUGINSDIR\io.ini test2.ini
  43. FunctionEnd
复制代码

  1. ; Ini file generated by the HM NIS Edit IO designer.
  2. [Settings]
  3. NumFields=4

  4. [Field 1]
  5. Type=Label
  6. Text=A Path:
  7. Left=25
  8. Right=73
  9. Top=20
  10. Bottom=28

  11. [Field 2]
  12. Type=DirRequest
  13. State=DirRequest
  14. Left=26
  15. Right=286
  16. Top=40
  17. Bottom=53

  18. [Field 3]
  19. Type=Label
  20. Text=B Path:
  21. Left=25
  22. Right=72
  23. Top=81
  24. Bottom=88

  25. [Field 4]
  26. Type=DirRequest
  27. State=DirRequest
  28. Left=26
  29. Right=286
  30. Top=96
  31. Bottom=108
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 09:13 , Processed in 0.107751 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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