Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Multiple Insert Lines in Text File? (http://forums.winamp.com/showthread.php?t=232979)

Please Help 111 12th December 2005 00:00

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

Here is what I want to do:

Quote:

Line1
Line2
Line3
Line4
To:

Quote:

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

Thanks for any help.

Instructor 12th December 2005 10:14

code:
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



All times are GMT. The time now is 05:49.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.