I have a need to replace the formatting of some phone #s in a list of more than 30,000 entries.
I have the file in TextEdit, but I can’t get the last and most important event to work. What is the correct syntax for this?
tell application "TextEdit"
set paraNumb to count of paragraphs of document 1
repeat with i from 1 to paraNumb
set thisPara to paragraph i of document 1
if thisPara contains ")" then
set offsetOne to (text offset of ")" in thisPara)
set theParens to "(" as string
set firstHalf to (characters 1 thru (offsetOne - 4) of thisPara) as string
set lastText to (characters (offsetOne - 3) thru (count of characters of thisPara) of thisPara) as string
set newText to firstHalf & theParens & lastText as string
set text of paragraph i of document 1 to newText
end if
end repeat
end tell
I get an error message every time:
I am sure there’s a simple answer, but no examples of this basic (or is it?) command can I find.
Thanks for help!