Let say I have the following text file :
- DEMO
- TEXT1
- TEXT2
- DEMO
etc....
DEMO
- TEXT1
- TEXT2
- DEMO
etc....
DEMO
- TEXT1
- TEXT2
- DEMO
- etc....
I would like to added some text between the first TEXT1 and TEXT2 (line 2/3)
so the text would be like :
- DEMO
- TEXT1 MY TEXT HERE
- TEXT2
- DEMO
etc....
DEMO
- TEXT1
- TEXT2
- DEMO
etc....
DEMO
- TEXT1
- TEXT2
- DEMO
- etc....
I know how I can filter the text to get the value of any text that would be there with the code bellow, but how can I add some text on my text file at this empacement ?
property leftEdge1 : "2. TEXT1"
property rightEdge1 : "3. TEXT2"
set myNewCaseNote to ""
set newFile to (path to desktop folder as text) & "_Note_Backup.txt"
set theSource to read file newFile
set theText to Unicode text
try
set saveTID to text item delimiters
set text item delimiters to leftEdge1
set classValue to text item 2 of theSource
set text item delimiters to rightEdge1
set myCaseNote to text item 1 of classValue
set text item delimiters to saveTID
myCaseNote
end try