Archive: Multiple Insert Lines in Text File?


Multiple Insert Lines in Text File?
How would I go about doing this?

Here is what I want to do:

Line1
Line2
Line3
Line4
To:

Line1
Line2
---Insertion1---
Line3
Line4
---Insertion2---
I would like to be able to insert at least 64 lines.

Thanks for any help.

Name "Output"
OutFile "Output.exe"

!include "TextFunc.nsh"
!insertmacro LineFind

Section
${LineFind} "C:\input.txt" "C:\output.txt" "3 5 8" LineFindCallback

IfErrors 0 +2
MessageBox MB_OK "Error"
SectionEnd

Function LineFindCallback
StrCmp $R8 3 0 next
FileWrite $R4 "---Insertion1a---$\r$\n"
FileWrite $R4 "---Insertion1b---$\r$\n"
goto end

next:
StrCmp $R8 5 0 next2
FileWrite $R4 "---Insertion2---$\r$\n"
goto end

next2:
StrCmp $R8 8 0 end
FileWrite $R4 "---Insertion3---$\r$\n"
goto end

end:
Push 0
FunctionEnd