NSIS当某些内容返回特定值时,如何取消隐藏某个部分?

时间:2012-09-10 09:49:14

标签: return hide nsis

我使用HM NIS Edit创建了一个安装程序。如果我的支票发现它没有安装,我希望能够取消隐藏名为VDF的部分。并在安装时隐藏它,也不执行嵌入式安装程序。

我希望我能说清楚。

这是功能:

Function .onInit #Check's wether the installer is in your installation folder. onInit means that it checks for that even before the installer is initialized.
  ${If} ${FileExists} "$EXEDIR\VDF2012-17.0.22.8.Client.exe"
    MessageBox MB_OK "VDF found"

  ${Else}
    MessageBox MB_OK "The Visual DataFlex setup was not found in the installation folder. However the installation of $(^Name) will still continue."

  ${EndIf}

1 个答案:

答案 0 :(得分:1)

要隐藏某个部分,您必须change its name为空字符串。

要检查/取消选中某个部分,您应该使用sections.nsh中的帮助程序宏。

!include sections.nsh

Section "VDF" SID_VDF
#Install VDF
SectionEnd

Function .onInit
${IfNot} ${FileExists} "$EXEDIR\VDF2012-17.0.22.8.Client.exe"
  !insertmacro UnselectSection ${SID_VDF}
  SectionSetText ${SID_VDF} ""
${EndIf}
FunctionEnd

要取消隐藏,您会给它一个非空名称,但默认情况下显示它通常较少,并在需要时隐藏...