在各种描述字符串中使用NSIS安装程序名称

时间:2019-05-14 05:41:47

标签: windows installer nsis

因此我的NSIS脚本将安装程序的Name作为第一行:

Name "Magic App"

现在有几页(COMPONENTS页,DIRECTORY页等),我覆盖了以下标准文本:

!define MUI_PAGE_HEADER_TEXT "Components to install"
!define MUI_PAGE_HEADER_SUBTEXT "The following features of Magic App will be installed."
!define MUI_COMPONENTSPAGE_TEXT_TOP "Click next to continue."
!define MUI_COMPONENTSPAGE_TEXT_COMPLIST "Components to install:"
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_HEADER_TEXT "Choose the folder where Magic App will be installed"
!define MUI_PAGE_HEADER_SUBTEXT "Magic App files will be installed."
!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will install Magic App in the chosen folder. To install Magic App, click Browse and select a folder. Click Next to continue."
!insertmacro MUI_PAGE_DIRECTORY

从上方可以清楚地看到,名称Magic App在所有描述字符串中被重复使用了很多次。因此,如果以后更改应用程序的名称,则需要在所有这些位置进行更改。

如何在这些描述字符串中重用安装程序的Name

我尝试使用${Name}

!define MUI_PAGE_HEADER_SUBTEXT "The following features of ${Name} will be installed."

但是它导致以下警告:

warning 6000: unknown variable/constant "{Name}" detected, ignoring (macro:MUI_PAGE_HEADER_SUBTEXT:10)

1 个答案:

答案 0 :(得分:1)

${Name}是用于访问定义的语法。您当然可以使用该名称创建一个定义,但是也可以使用langstring语法直接访问名称属性

!define MUI_PAGE_HEADER_SUBTEXT "$(^Name) files will be installed."