Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I forgot to add that this is for CS4
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks Phil.
I tried this, but it does not retain all of the original formatting.
Any suggestions?
Jim
Copy link to clipboard
Copied
Hi Jim,
Its working for me good, if you done mine can you please post your document.
thx
csm_phil
Copy link to clipboard
Copied
Unfortunately, I can't. I'm under a non-disclosure as to the doc I'm working on.
Jim
Copy link to clipboard
Copied
Hi Jim,
Can you send the snapshot of the error or you document.
thx
csm_phil
Copy link to clipboard
Copied
csm_phil,
did you test your script with a rather complex document? With rather complex I think of paragraph styles based on each other, same paragraph names in different subfolders, character styles, GREP styles, object styles, cell styles, list styles …
To break all the links to the styles, it might be important to keep a distinct order.
Try to remove the styles in the following order:
(( 0. Cell styles (sometimes it was inevitable for me to delete cell styles to perform the task without a script, but I did not research or recall the exact conditions ))
1. Character Styles
2. Paragraph Styles
Hope that helps,
Uwe
Copy link to clipboard
Copied
Hi Laubender,
Yes, i have tried the above mentioned code in the simple InDesign document this contains all paragraphstyles and characterstyles and break to link style its worked fine.
you can create the simple document and you use the js code it will work or not if the script is worked can you include whatever things you needed.
thx
csm_phil.
Copy link to clipboard
Copied
Somehow Indesign is seeing an attachment to a style that does not even exist in the doc anymore. Very Strange. I don't think breaking the link to styles will help me anymore. I am trying to figure out why my files continue to crash after I format type with a Korean font. Thought the font was bad, purchased new copy, same issue. Noticed it would always bomb related to a certain style which contained nested styles, hence the idea to break link to style. But how can you break a link to a style that doesn't exist anymore.
I think I may need to reinstall indesign and see if I continue to have the issue with these docs.
Thanks for your help.
Come to think of it, how would you write a script to delete all unused paragraph styles and character styles. Is that possible?
Jim
Copy link to clipboard
Copied
Hi Jim,
You can use the Harbs Script delete the ParagraphStyles.
I give the reference link: http://forums.adobe.com/message/2286470#2286470
You can clear the InDesign Preferences:
MAC: cmd+opt+shift press and open simultaneously the InDesign CS4.
Windows: ctrl+alt+shift press and open simultaneously the InDesign CS4.
thx
csm_phil