Archive: Text Replace Using LineFind fails


Text Replace Using LineFind fails
Hi all,

i use


Name ZZ_LineReplace

OutFile ZZ_LineReplace.exe

!include "MUI2.nsh"
!include Sections.nsh

!include "TextFunc.nsh"
!insertmacro LineFind
!include "WordFunc.nsh"
!insertmacro WordReplace

ShowInstDetails Show

!insertmacro MUI_PAGE_INSTFILES

Section Install
SetOverwrite ON
SetOutPath "D:\"
File unattend.txt

Push "MyCompany"
Push "TESTCOMPANY"
${LineFind} "D:\unattend.txt" "D:\unattend1.txt" "1:-1" "LineReplaceFunction"

SectionEnd

Function LineReplaceFunction
Pop $R0
Pop $R1
DetailPrint $R9
${WordReplace} '$R9' '$R1' '$R0' '+*' $R9
Push $0
FunctionEnd


to try and edit the unattend.txt file, but even though i have specified "1:-1" for Line Find it stops after the first Line.....

the file unattend.txt (for now) contains


Line1
Line2
Line3
Line4
MyCompany
Line6
MyCompany
Line8
Line9



Any Ideas?

POPing disturbs the whole thing, it works this way


Section Install
SetOverwrite ON
SetOutPath "D:\"
File unattend.txt

StrCpy $R1 "MyCompany"
StrCpy $R0 "TESTCOMPANY"
${LineFind} "D:\unattend.txt" "D:\unattend.txt" "1:-1" "LineReplaceFunction"

SectionEnd

Function LineReplaceFunction
DetailPrint $R9
${WordReplace} '$R9' '$R1' '$R0' '+*' $R9
Push $0
FunctionEnd


Why does one always find out how it works, AFTER one has posted to the board
:igor: