Skip to main content
Participant
May 25, 2011
Question

Break link to style script

  • May 25, 2011
  • 1 reply
  • 3509 views

Can someone help me write a script that will "Break link to style" for all paragraph styles and character styles for all text on a spread but keep the formatting?

Thanks,

Jim

This topic has been closed for replies.

1 reply

Participant
May 25, 2011

I forgot to add that this is for CS4

csm_phil
Legend
May 25, 2011

Hi Jim,

You have to try my below JS Code, i am using Menu Actions;

#target "InDesign-6.0"
var myDoc = app.activeDocument;

for (i=0; i<myDoc.stories.length; i++){
    for (j=0; j<myDoc.stories.paragraphs.length; j++){
        app.select(myDoc.stories.paragraphs);
        //Break paragraph styles
        BreakParaStyle = app.menuActions.itemByID(8500);
        try {
            BreakParaStyle.invoke();
            }
        catch (err){};
        //Break character styles
        BreakCharStyle= app.menuActions.itemByID(8501);
        try {
            BreakCharStyle.invoke();
            }
        catch (err){};
        app.selection = null;
        }
    }
alert("Done");

thx

csm_phil

Participant
May 25, 2011

Thanks Phil.

I tried this, but it does not retain all of the original formatting.

Any suggestions?

Jim