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

Nested overrides

Contributor ,
Aug 24, 2015 Aug 24, 2015

Copy link to clipboard

Copied

Hi All,

If possible to find the nested style's override (contents) with script?

Example here:

1. The first line is Nested.

2. the italic word is nested override.

Screen shot 2015-08-24 at 3.27.11 PM.png

TOPICS
Scripting

Views

356
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

correct answers 1 Correct answer

Contributor , Aug 24, 2015 Aug 24, 2015

Hi, try this code.

styleOverridden property will help you to found overriden

var doc = app.documents[0];

var story = doc.stories[0];

var tsr = story.textStyleRanges;

for (var i=0, len=tsr.length; i < len ; i++) {

  if (tsr.styleOverridden) {

    $.writeln(tsr.contents);  

    $.writeln(tsr.index);  

  }

};

thankyou

Votes

Translate
Contributor ,
Aug 24, 2015 Aug 24, 2015

Copy link to clipboard

Copied

Hi, try this code.

styleOverridden property will help you to found overriden

var doc = app.documents[0];

var story = doc.stories[0];

var tsr = story.textStyleRanges;

for (var i=0, len=tsr.length; i < len ; i++) {

  if (tsr.styleOverridden) {

    $.writeln(tsr.contents);  

    $.writeln(tsr.index);  

  }

};

thankyou

Votes

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
Contributor ,
Aug 25, 2015 Aug 25, 2015

Copy link to clipboard

Copied

LATEST

Hi Milligramme,

Thank you so much for your help, your effort more valuable for me.

Here is my target.

var doc = app.activeDocument; 
var story = doc.stories.everyItem().getElements(); 
for (i=0; i<story.length; i++)
{
    var tsr = story.textStyleRanges;
    for (j=0; j<tsr.length; j++)
    {
        if (tsr.styleOverridden)
        {
            if (tsr.paragraphs[0].nestedStyles.length!=0)
            {
        alert(tsr.parentTextFrames[0].parentPage.name+"\t"+tsr.contents)
        }
            }
        }
    }

Thanks,

Selva

Votes

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