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

Code to be evaluated! [007] // Grep Research and Text Frame …

LEGEND ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Hi Scripters,

I make a Grep research on a "XXX" para style and I want, after, to manipulate the text frame containing the paras I found!

So, is this code correct to begin?

var myDoc = app.activeDocument;       

app.findGrepPreferences = app.changeGrepPreferences = null;

app.findGrepPreferences.appliedParagraphStyle = "XXX";

var myFound = myDoc.findGrep();

for(var F = 0; F < myFound.length; F++) 

    {

        var myTextFrame = myFound.parent.textFrames;

        //………

    }

Thanks in advance! 

(^/)

TOPICS
Scripting

Views

228

Translate

Translate

Report

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 ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

1. Open the ESTK, open the Console.

2. Select some text in an InDesign document.

3. In the ESTK console, enter app.selection[0].parent and press Enter

4. What does the console reply?

P.

Votes

Translate

Translate

Report

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
LEGEND ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Hi Peter!

app.selecton[0].parent  =>  Result : [object Story]

app.selecton[0].parent.textFrames  =>  Result : [object TextFrames]

… So, I'm right!? 

(^/)

Votes

Translate

Translate

Report

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 ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

LATEST

Try this:

app.selecton[0].parent.textFrames.length

=> Result: 0

So that doesn't work.

Go to the OMV, look under any text property, e.g. Character. You'll see that it has a property 'parent', but you already found that that doesn't work. After 'parent' is 'parentTextFrames'. Try that:

app.selection[0].parentTextFrames

and see what happens.

Be adventurous!

P.

Votes

Translate

Translate

Report

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