Paragraph delimiter: how to...

Hi I’m trying to split an rtf into multiple textstrings and don’t understand how to set a paragraph delimiter to “¢¢¢¢” with applescript text item delimiters. I have a file which contains “entries” separated by “¢¢¢¢” and i’d like to create new entries for later processing them. Can anybody help?
Thanks
Nestor

try something like this:


set theData to "One¢¢¢¢two¢¢¢¢three¢¢¢¢four"

set my text item delimiters to "¢¢¢¢"
set myParagraph to (paragraph 1 of theData)
set {mybulletOne, mybulletTwo, mybulletThree, mybulletFour} to {text item 1 of myParagraph, text item 2 of myParagraph, text item 3 of myParagraph, text item 4 of myParagraph}

I think the problem is that its an RTF file I tried using text item delimiters with rtf file and when it reads in the rtf file there is a bunch of code at the top and the “¢” get converted to this "'a2" if they where plain text or if there is a way to convert them to plain text then I could give you what your looking for

mm

No problem to convert to txt. The point is that I want to deal not with a ‘certain’ text string but with every data “between” the text delimiter. So I can’t use:

set theData to "One$Two$Three"

Here’s a Text Sample:

¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢

As the return is an important character for viewing the data I can’t use the “paragraph” to split the entries and I would like to get the text of the first entry, the text of second entry and so on…
:frowning:
Thanks
Nestor

Hi Nestor,

something like this?


set theData to "¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢
"

set {TID, text item delimiters} to {text item delimiters, "¢¢¢¢"}
set dataList to text items of theData
set text item delimiters to TID
dataList

Hi StephanK,
yes and not. I mean the data between the couple of delimiters is not predetermined so I was wondering if it’s possible to build a script that simply split the text into blocks of data delimited by “¢¢¢¢” and then processing each block as a separate entry…
thanks
Nestor

the script above does split the text into blocks (list items)

you now just need to iterate through each item


set theData to "¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢
TITLE: XXXXXXX
YEAR: XXXXXX
KIND:XXXXXX
ETC.
¢¢¢¢
"

set {TID, text item delimiters} to {text item delimiters, "¢¢¢¢"}
set dataList to text items of theData
set text item delimiters to TID
dataList

 repeat with anEntry in DataList
-- process  anEntry here
end repeat