Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Replace overset text

Guest
May 25, 2010 May 25, 2010

When I search and replace text in a specific text box I have to make it bigger since I can´t get it to replace overset text.

Is it possible or do you do the same?

TOPICS
Scripting
732
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2010 May 25, 2010

That is correct; if you use changeText on a text frame, it only works on what's visible.

But it should be possible to use the same changeText on the entire story in that text box (yourFrame.stories[0]) -- that will include overset text.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 25, 2010 May 25, 2010

textFrame.stories doesn´t seem to work, only application has stories as far as I can tell. But it does work to loop the paragrahs of the textframe and it seems to be fast enough for me.

var my_frame = app.documents[0].selection[0];

app.findTextPreferences = NothingEnum.nothing;

app.changeTextPreferences = NothingEnum.nothing;

app.findTextPreferences.findWhat = "find";

app.changeTextPreferences.changeTo = "replace";

for(i = 0; i < my_frame.paragraphs.length; i++) {

    my_frame.paragraphs.changeText();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 25, 2010 May 25, 2010

You need to use my_frame.parentStory instead of my_frame.stories.

Here is working code.

var my_frame = app.documents[0].selection[0];
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = "find";
app.changeTextPreferences.changeTo = "replace";
my_frame.parentStory.changeText()

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 25, 2010 May 25, 2010
LATEST

Of course

Each story can have multiple text frames but each frame can only be associated with one single story ... (I should have checked the Help.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines