Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 13th October 2009, 13:26   #1
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 176
Text Replace Using LineFind fails

Hi all,

i use

code:

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

code:

Line1
Line2
Line3
Line4
MyCompany
Line6
MyCompany
Line8
Line9




Any Ideas?
xbarns is offline   Reply With Quote
Old 13th October 2009, 13:35   #2
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 176
POPing disturbs the whole thing, it works this way

code:

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
xbarns is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump