Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I have modified this script so I can delete & replace paragraph styles...
var myDocument = app.activeDocument;
if (myDocument.paragraphStyles.item("SBS Step i") != null) {
if (myDocument.paragraphStyleGroups.item("MainStyles"). paragraphStyles.item("SBS Step i2") != null) {
myDocument.paragraphStyles.item("SBS Step i").remove("SBS Step i2")
}}
It is working find but, not if the "SBS Step i2" styles is inside a Group. How can we specify if a paragraph is from a group when removed.
JC
Copy link to clipboard
Copied
Try this:
myDocument.paragraphStyles.item("SBS Step i").remove(myDocument.paragraphStyleGroups.item("MainStyles"). paragraphStyles.item("SBS Step i2"));
Copy link to clipboard
Copied
Kaysan, thanks that works....
Copy link to clipboard
Copied
I found this script hoping it would help me out. We recently updated the template to one of our books so the paragraph & character style names line up with other projects. I added two lines to the script in the format shown and ran the script and it worked. "Great!" I thought. But when I made a comprehensive list (the script is 47 lines long), it suddenly gives me error messages and won't even get through one line of the script! I have confirmed that both the old and new style names are present in the document and match exactly. Can anyone help me understand what I'm doing wrong? I've attached the warning message and a few lines of the script. I am working in CS4. Thanks,
Matt
var myDocument = app.activeDocument;
myDocument.paragraphStyles.item("Body - Recipe Head").remove("STORY HEAD");
myDocument.paragraphStyles.item("Body - Recipe Head 2 line").remove("STORY HEAD 2LINE");
myDocument.paragraphStyles.item("Body-Recipe Head 3 lines").remove("STORY HEAD 3LINE");
myDocument.paragraphStyles.item("Body - Indent").remove("STORY BODY");
(continues this pattern for other styles)
Copy link to clipboard
Copied
Try to reference paragraph style as Object instead of String:
myDocument.paragraphStyles.item("Body - Recipe Head").remove(myDocument.paragraphStyles.item("STORY HEAD"));
Copy link to clipboard
Copied
/* IT SHOULD READ AS BELOW, REPEAT FOR EACH STYLE YOU WILL REPLACE */
var myDocument = app.activeDocument ;
myDocument.paragraphStyles.item( "Body - Recipe Head" ).remove ( myDocument.paragraphStyles.item( "STORY HEAD" ) ) ;
Copy link to clipboard
Copied
Herr Meuller, I tried that but I am still getting the same warning message. I tried it with and without the spaces you included in your example. What am I doing wrong?
Copy link to clipboard
Copied
OK, I just tried this again in another document and it worked fine. Not sure what was going on with the document I was trying the first time, but it seems to be OK. I'll report back and let you know if I have any problems. Thank you both.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now