Deleting paragraphs in TextEdit
Hi there,
I'm having some issues deleting certain paragraphs in a document. I want to delete every paragraph which doesn't start with '{'. I have done this so far:
tell application "TextEdit"
activate
open "/Users/John/Desktop/map.rtf"
set this_text to the text of document 1
end tell
set the paragraph_list to every paragraph of this_text
repeat with i from 1 to the count of paragraphs of this_text
set this_paragraph to itemi of the paragraph_list
try
if first character of this_paragraph is not "{" then
deleteitemi of paragraph_list
end if
on error --If there isn't any character
deleteitemi of paragraph_list
end try
end repeat
I don't know what I am doing wrong. Thanks in advance.