1

我正在使用 nsis 安装程序创建安装程序。在那个安装程序中,我需要放置一个用于货币选择的下拉菜单。

我使用的文本文件没有被正确插入,我用来分隔货币的换行符实际上在安装程序中使用了一个字符,而对于许可证页面,我对我使用的文本文件使用相同的扩展名我放在那里,它在那里工作正常。

如何过滤掉那些多余的字符?

4

1 回答 1

1

如果没有示例文件,我不得不猜测实际问题是什么,希望它只是换行符:

Page custom mycustompage

!include nsDialogs.nsh
!include TextFunc.nsh

Function mycustompage
nsDialogs::Create 1018
Pop $0

; I don't have a list of things so I generate one on the fly for this example:
!tempfile MYLIST
!appendfile "${MYLIST}" "Foo$\r"
!appendfile "${MYLIST}" "Bar$\r$\n"
!appendfile "${MYLIST}" "Baz$\n"
File "/oname=$pluginsdir\thelist.txt" "${MYLIST}" ; include list in installer
!delfile "${MYLIST}"

${NSD_CreateDropList} 10u 10u 50% 100% ""
Pop $0

FileOpen $1 "$pluginsdir\thelist.txt" r
loop:
    FileRead $1 $2
    IfErrors endloop
    ${TrimNewLines} $2 $2
    StrCmp $2 "" loop ; skip empty line
    ${NSD_CB_AddString} $0 $2
    goto loop
endloop:

nsDialogs::Show
FunctionEnd
于 2012-10-04T05:25:18.090 回答