2012-09-10 17 views
0

我有一個使用HM NIS Edit創建的安裝程序。我希望能夠取消隱藏VDF部分,如果我的檢查發現它沒有安裝。並在安裝時隱藏它,也不要執行該嵌入式安裝程序。NSIS如何在返回特定值時取消隱藏某個部分?

我希望我明確自己。

這是函數:

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} 

回答

0

要隱藏一個部分,你必須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 

要隱藏你想給它一個非空的名字,但它通常是不太默認和隱藏在需要時顯示它的工作...

+0

謝謝,就像一個魅力! –

相關問題