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

Move Paragraph Styles back to their existing Groups

Enthusiast ,
Apr 17, 2017 Apr 17, 2017

Copy link to clipboard

Copied

HI ALL,

Request:

1. Move Paragraph Styles from paragraph styles group to normal   //working fine

2. Import XML into active doc   //working fine

3. Again Move normal paragraph Styles to the same existing Groups  //Need HELP

Trying below code:

Move Paragraph Styles from paragraph styles group to normal

//Task 1:

var myDoc = app.activeDocument; 

myGroup_Name_Array = [];

myPstyle_Name_Array = [];

var myPStyle_Groups = app.activeDocument.paragraphStyleGroups;

for(p=0; p<myPStyle_Groups.length; p++)

{

    myGroup_Name_Array.push(myPStyle_Groups

.name)

    var myGroups_Pstyles = myPStyle_Groups

.paragraphStyles.everyItem().getElements();

    for(g=0; g<myGroups_Pstyles.length; g++)

    {

        myPstyle_Name_Array.push(myGroups_Pstyles.name)

        myGroups_Pstyles.move(LocationOptions.AT_END, myDoc)   //Move styles from Groups

       

        }

    }

//Task 2:

//Import XML to indesign  //working fine

//Task 3: (Need Help)

//Again Move normal paragraph Styles to the same existing Groups

Thanks & Regards

Siraj

TOPICS
Scripting

Views

414

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
Enthusiast ,
Apr 17, 2017 Apr 17, 2017

Copy link to clipboard

Copied

LATEST

Hi All,

Got the output...

var myDoc = app.activeDocument; 

myTemp = []

myTemp_Parent = [];

var myPStyle_Groups = app.activeDocument.paragraphStyleGroups;

for(p=0; p<myPStyle_Groups.length; p++)

{

    var myGroups_Pstyles = myPStyle_Groups

.paragraphStyles.everyItem().getElements();

    for(g=0; g<myGroups_Pstyles.length; g++)

    {

       

      myTemp.push(myGroups_Pstyles)

      myTemp_Parent.push(myGroups_Pstyles.parent)

        myGroups_Pstyles.move(LocationOptions.AT_END, myDoc)   //Move styles from Groups

       

        }

    }

for(x=0; x<myTemp.length; x++){

    alert(myTemp.name)

    myTemp.move(LocationOptions.atEnd, myTemp_Parent)

    }

Thanks

Siraj

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