Skip to main content
Known Participant
June 9, 2008
Question

Find and replace text CS2

  • June 9, 2008
  • 2 replies
  • 221 views
hi scripters

here I am trying to find the text applied Arial font. I just want to replace some text before and after the text.

I have started but I am struck what's next, can you any one suggest me please

app.findPreferences = NothingEnum.nothing;
app.changePreferences = NothingEnum.nothing;
app.findPreferences.appliedFont = 'Arial';
var myResults = app.activeDocument.search();

for (i = myResults.length-1; i >= 0; i--)
{
(myResults.select())
}

example:
Text found applied font Arial : "I am Arial font"
Want to replace same font but text like this: "I am Arial Font"

Thanks in advance

regards
a r u l
This topic has been closed for replies.

2 replies

hm_arulAuthor
Known Participant
June 9, 2008
Thanks a lot Dave, its working well thanks again
Inspiring
June 9, 2008
You're already iterating backwards, which is good. Just set your tags into the insertion points of the found results (doing the trailing one first). So, inside the loop you'd have:

myResults.insertionPoints[-1].contents = "</ar>";
myResults.insertionPoints[0].contents = "<ar>";

Dave