Archive: replaceInFile replacing everything!!?


replaceInFile replacing everything!!?
I've had a look around the forums & google but couldnt find anyone else that's had this problem.

I've been using replaceInFile to change the values of strings in config files to the installation path. I dont know what I've changed, but now it seems to replace the whole text file with the value.

here's a very cut down version of the code


OutFile "rename_test.exe"
InstallDir "$PROGRAMFILES\Scorecard"


!include StrSlash.nsh
!include ReplaceInFile.nsh
!include StrRep.nsh

!include MUI.nsh

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\scorecard\score1.bmp"
!define MUI_ABORTWARNING
!define ROOT "c:\scorecard"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

Section ""

SetOutPath $INSTDIR
File "c:\scorecard\test.txt"

Push $INSTDIR
Push "\"
Call StrSlash
Pop $R0 ;$R0 now contains the instdir with forward slashes

!insertmacro ReplaceInFile "$INSTDIR\test.txt" "?REPLACE" $R0

SectionEnd

!insertmacro MUI_LANGUAGE "English"


the text.txt file has a few lines with random text and a few ?REPLACE words in. These WERE being replaced by the installation directory, but now it's just filling the file with that path.

where have I gone wrong??!!
thanks in advance...

Just a suggestion that you might find helpful :)
Did you try More advanced replace text in file?
http://nsis.sourceforge.net/More_adv...e_text_in_file


that one has worked nicely - thank you!