Hi,
I'm using Afrow's nice function to replace words in a specific line. The function is in the archive at:
But when I need to replace several words in one section I get an error, because I need to call the function several times. I packed the function into a macro which I can call like:
!insertmacro ReplaceOnLine LINE FILE TOREPLACE REPLACEWITH
Compiling the script I get an error message
Error: label "Top:" already declared in section/function
and then the script fails.
Does someone have an idea how I can replace several words in one section of the installer?
Another (minor) problem of the function is that it will not work when the word occure more then once on the line.
Looking forward to hear your ideas.
Best regards
Peter
call Function ReplaceOnLine several times
2 posts
Does someone have an idea how I can replace several words in one section of the installer?Function LineFind + Function WordReplace
!include "TextFunc.nsh"
!insertmacro LineFind
!include "WordFunc.nsh"
!insertmacro WordReplace
Section
${LineFind} "input.file" "output.file" "1:-1" "LineFindCallback"
IfErrors 0 +2
MessageBox MB_OK "Error"
SectionEnd
Function LineFindCallback
${WordReplace} '$R9' ' ' '_' '+*' $R9
${WordReplace} '$R9' '123' '321' '+' $R9
Push $0
FunctionEnd