dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Tue Jan 22, 2008 5:56 pm Post subject: Take a Look at This |
|
|
Run the following prototype and see if it might be what you had in mind: | Code: | FileContentsIn=
(
My text
N1#####
######
######
My text
N2#####
######
N3
######
######
)
;Commented lines are a file input/output version of this script
Loop, Parse, FileContentsIn,`n
;Loop, Read, C:\YourFileNameInHere, C:\YourFileNameOutHere
{
if(SubStr(A_LoopField,1,1)="N"){ ;check to see if previous line was My text
; if(SubStr(A_LoopReadLine,1,1)="N"){ ;check to see if previous line was My text
if(HoldPreviousLine<>"My text"){ ;insert My text
FileContentsOut=%FileContentsOut%My text`n
; FileAppend, My text`n
}
}
FileContentsOut=%FileContentsOut%%A_LoopField%`n
; FileAppend, %A_LoopReadLine%`n
HoldPreviousLine:=A_LoopField
; HoldPreviousLine:=A_LoopReadLine
}
msgBox,%FileContentsOut%
|
There are several commented out lines that could be uncommented so that this same prototype would work for file input/output. Of course, you have to remove or comment out the "FileContents" version of each line that you uncomment and put in legitimate file names.
Give it a try,
dmatch |
|