Skip to main content
Anantha Prabu G
Legend
January 27, 2017
Question

Find the same styles in two Documents

  • January 27, 2017
  • 1 reply
  • 298 views

Hi All,

I am new in inDesign scripting, please tell me how to write a script to get same styles of paragraph and character styles in both of two InDesign documents. I am trying the script store the styles in one variable. Here is the code:

var myDoc =app.documents[0];

var myPstyle = app.documents[0].paragraphStyles.everyItem(0).getElements(0);

alert(myPstyle.length)

for(i=2; i<myPstyle.length; i++)

{

    var newStyle = myPstyle.name;

    }

var myDoc1 =app.documents[1];

var myPstyle1 = app.documents[1].paragraphStyles.everyItem(1).getElements(1);

alert(myPstyle1.length)

for(i=2; i<myPstyle1.length; i++)

{

    var format = myPstyle1.name;

    }

Is this even possible?

Thanks,

Prabu G

This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
January 29, 2017

Simply use .importStyles(). You can find the details in one of the object-model viewers.

P.

Anantha Prabu G
Legend
January 30, 2017

Hi  pkahrel,

Thanks for the guidance.

Thanks,

Prabu G

Design smarter, faster, and bolder with InDesign scripting.