1

我目前正在为一个客户端开发几个 Anti-Virus 的软件包安装程序,我遇到了一个问题,即描述性文本无法正常工作,因为它记录在 MUI2 上。

!insertmacro MUI_LANGUAGE "English"

LangString DESC_avg ${LANG_ENGLISH} "Install AVG Anti-Virus: Because Norton doesn't work."
LangString DESC_cc ${LANG_ENGLISH} "Install CCleaner PC Optimizer: Clearing your junk files since 2005."
LangString DESC_mb ${LANG_ENGLISH} "Install MalwareBytes Anti-Virus: Because no anti-virus is perfect."
LangString DESC_ff ${LANG_ENGLISH} "Install Firefox Internet Browser: Friends don't let friends use Internet Explorer"
LangString DESC_sb ${LANG_ENGLISH} "Install Spybot Virus Removal: Only for getting rid of those particularly pesky virus$\'"

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SectionAVG} ${DESC_avg}
    !insertmacro MUI_DESCRIPTION_TEXT ${SectionCC} ${DESC_cc}
    !insertmacro MUI_DESCRIPTION_TEXT ${SectionMB} ${DESC_mb}
    !insertmacro MUI_DESCRIPTION_TEXT ${SectionFF} ${DESC_ff}
    !insertmacro MUI_DESCRIPTION_TEXT ${SectionSB} ${DESC_sb}
!insertmacro MUI_FUNCTION_DESCRIPTION_END

它可以正确安装所有东西,我正处于使它看起来很专业的最后阶段。我以正确的格式引导每个部分(我相信)。

Section "AVG Anti-Virus" SectionAVG

;Install everything here

SectionEnd

;other sections...

问题是它可以编译,但不显示任何描述的信息。是否有一些我遇到的脚本错误不在文档中?也许其他一些没有首先涉及的步骤?

感谢您提前提供任何帮助。我才刚刚开始学习如何使用 NSIS,但是一旦您知道自己在做什么,它似乎是一个非常强大的工具。

4

1 回答 1

4

它按文档说明工作,但您没有遵循文档!

MUI_FUNCTION_DESCRIPTION_BEGIN/END 块必须位于 .nsi 中的部分之后(MUI 帮助文件在“组件页面描述”部分中对此进行了说明)。这样做的原因是${SectionAVG}在声明该部分之后不会定义 util 。使用LangString字符串时,您还需要使用正确的语法:$(lang_string_id).

!include MUI2.nsh
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English

LangString DESC_avg ${LANG_ENGLISH} "foo foo foo foo foo foo foo foo foo"
LangString DESC_cc ${LANG_ENGLISH} "bar BAR bar"

Section "AVG Anti-Virus" SectionAVG
SectionEnd
Section "CCleaner" SectionCC
SectionEnd

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionAVG} $(DESC_avg)
!insertmacro MUI_DESCRIPTION_TEXT ${SectionCC} $(DESC_cc)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
于 2014-02-12T04:07:06.870 回答