【问题标题】:NSIS "MUI_DESCRIPTION_TEXT" not working as documentedNSIS“MUI_DESCRIPTION_TEXT”没有按记录工作
【发布时间】:2014-02-11 20:04:33
【问题描述】:

我目前正在为一个客户端开发多个 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,但是一旦您知道自己在做什么,它似乎是一个非常强大的工具。

【问题讨论】:

    标签: nsis nsis-mui


    【解决方案1】:

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

    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
    

    【讨论】:

    • 啊,好的,非常感谢!不太习惯使用这样的脚本语言,所以有时我会忽略声明的顺序,这是我在文档中没有注意到的。我猜,这是我们有时都会犯的那些令人尴尬的新手错误之一。总之,非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2013-04-16
    • 2021-01-26
    • 2015-10-19
    • 2023-04-01
    • 1970-01-01
    • 2011-02-18
    • 2019-04-28
    • 1970-01-01
    相关资源
    最近更新 更多