Take the 2-minute tour ×

I am creating a installer using the nsis installer. In that installer I need to put a drop down menu for currency selection.

The text file which I am using is not being properly inserted, the newline character that I am using to separate the currencies is actually taking a character in the installer, while for the license page I am using the same extension for the text file which I am putting there and it is working fine over there.

How to filter out those extra characters?

share|improve this question
Can you put an excerpt of code, showing how you are inserting the file contents? Also, your license file may be in a different line end encoding (dos/mac/unix) than your currencies file. –  Seki Oct 3 '12 at 16:21
add comment

1 Answer

Without a sample file I had to guess what the actual problem is, hopefully its just the newlines:

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
    FileRead $1 $2
    IfErrors endloop
    ${TrimNewLines} $2 $2
    StrCmp $2 "" loop ; skip empty line
    ${NSD_CB_AddString} $0 $2
    goto loop

share|improve this answer
Thanks a lot,it is working for a new function,but i am failing to add it to a function itself.May be i do not know as i am new to it.If you could help more then it would be of great help.Do you know any other link apart from sourgeforce to study about the xpui and nsis? –  user1717161 Oct 4 '12 at 8:58
Other than the FileClose I forgot, that code should be ready to go, what is the problem exactly? –  Anders Oct 4 '12 at 10:24
Thanks a ton,it worked.. :) –  user1717161 Oct 5 '12 at 12:59
You should accept the answer if it fixed your problem... –  Anders Oct 5 '12 at 15:38
add comment

Your Answer


