Remove unused paragraph Styles - without basedOn styles
Hi all
I have remove the unused paragraph style, re-flow the pattern content also deleted "basedOn" style.
How to avoid remove basedOn styles.
Example here:
1. I have not used the '06 extract"style of paragraph directly in paragraphs (texts), so it's the unused paragraph style.
2. I applied "06 extract 1 P" style of paragraph directly in paragraphs (texts), but connected the pstyle "06 extract" to indirectly ' 06 1 P "(avec l'option basedOn) see below excerpt.". "
Removing unused styles, the "06" excerpt has also removed and affects '06 extract 1 P. So, re-flow occurring in this document, how to avoid this? No need to remove by using the 'basedOn' styles (example: "06 extract").
myDoc var = app.activeDocument;
var myParStyles = myDoc.paragraphStyles;
var myCharStyles = myDoc.characterStyles;
for (I = myParStyles.length - 1; i > = 2; i--) {}
removeUnusedParaStyle (myParStyles [i])
}
for (I = myCharStyles.length - 1; i > = 2; i--) {}
removeUnusedCharStyle (myCharStyles [i])
}
function removeUnusedParaStyle (myPaStyle) {}
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedParagraphStyle = myPaStyle;
var myFoundStyles = myDoc.findText ();
If (myFoundStyles == 0) {}
myPaStyle.remove ();
}
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
}
function removeUnusedCharStyle (myChStyle) {}
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedCharacterStyle = myChStyle;
var myFoundStyles = myDoc.findText ();
If (myFoundStyles == 0) {}
myChStyle.remove ();
}
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
}
Thank you in advance,
Dev
before checking if the paragraph style is in use, check if all other models are based on it. something on the lines of (warning code, bad, inefficient to come):
for (i = myParStyles.length - 1; i >= 2; i--) { for (var z = 0; z < myDoc.allParagraphStyles.length; z++) { var goodToRemove = true; if (myDoc.allParagraphStyles[z].basedOn == myParaStyles[i]) { //mark the parastyle as not to remove goodToRemove = false; break; } } if (goodToRemove) { removeUnusedParaStyle(myParStyles[i]); } }
Tags: InDesign
Similar Questions
-
Count the unused paragraph styles
I want to check InDesign documents my students to see if they have been neatly with their style sheets. I have a script that works partially (I think this would work in CS4, if you replace CS4 CS5).
The bit that does not try to save the styles within groups. I commented in the script to display the error section. I get the error:
"Invalid value for the set property" applied paragraph style". "Planned to string, the style section or anything, but will put \"body text (body). " "number 30477
I tried to put the name of the style and the group, because that's how it works if you do it manually, IE body text (body). But it does not work.
Any help would be appreciated.
property myTypeReport: ' " - makes available anywhere.
" game of myTypeReport to '" - prevents report becomes cumulative when running several times.
Tell application "Adobe InDesign CS5"
the value myDocument to rating 1
game of unusedStyles to "'
game of myFoundItems to "'
game myDescription to "unused paragraph styles"
the value myParagraphStyleGroups for each paragraph style group of myDocument
the value myParagraphStyles for each paragraph style of myDocument
Repeat with I have a 3 in (County of myParagraphStyles)
define myStyle to the the point i of myParagraphStyles name
the value find text preferences for Nothing
the value text preferences to change anything
the value applied paragraph style to find text preferences to myStyle
tell myDocument
the value myFoundItems to find text
if (account myFoundItems) = 0 then the value unusedStyles to (unusedStyles + 1).
end say
end Repeat
-This is the section of the error
Repeat with x 1 to the number of myParagraphStyleGroups
set myGroup to the of the point x of myParagraphStyleGroups name
the value myParagraphStyles for this entire paragraph styles to paragraph style group myGroup of myDocument
Repeat with I have from 1 to (count of myParagraphStyles)
game of myStyle to (name of point i of myParagraphStyles) & "(" & myGroup & "") " string "
-Returns the myStyle
the value find text preferences for Nothing
the value text preferences to change anything
the value applied paragraph style to find text preferences to myStyle
tell myDocument
the value myFoundItems to find text
if (account myFoundItems) = 0 then the value unusedStyles to (unusedStyles + 1).
end say
end Repeat
end Repeat
-finish the section error
"myReport game to "(" & unusedStyles & "")" " & "\t\t" & myDescription
if (County unusedStyles) > 0 then the value myTypeReport to myTypeReport & myReport and return
return myTypeReport
end sayCan you make best use of all styles of paragraph in your document instead of styles of paragraph of the document, which should access the independent styles of groups? You would have to give on the name using as reference (probably a good thing anyway) and use the style itself (in your find/replace).
-
Remove the paragraph style name space
Hi all
There is a space character at the end of my paragraph style name.
How can we delete [space] after the end of the paragraph style name? I don't want to delete [space] if she came between paragraph style names.
Please provide the js code.
Thank you
Tansk
Please provide the js code.
Oh sure, you hurry, right?
You can not call the forum for all the subordinate tasks script? Please? In these six hours you were to twiddle their thumbs and nervously checking the forum every five minutes or so, you could do this by hand.
Oh whatever:
for (p=2; p
-
remove unused styles from a single action...
Hello world
Is there a faster and better way to remove unused paragraph styles and character in InDesign without closure styles. Here is my script created. Its working fine.
//-----------------------------
var doc = app.activeDocument;
var pStyle = doc.paragraphStyles;for (i = pStyle.length - 1; i > = 2; i--) {}
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = pStyle [i];
var myFind = app.findText (false);
If (myFind == 0) {}
pStyle [i] .remove ();
}
}
Alert ("OK");//----------------------------
But in our documents, we have many styles. So above script takes a few minutes to perform the task. It would be better if she has the action runs in a few seconds. Can someone look into this and provide me with a better solution.
Thanks in advance
Indana
Here is how I could do this:
ArrayCompress=function(array){ var str = array.sort().join('\r')+'\r' str = str.replace(/([^\r]+\r)(\1)+/g,'$1') str = str.replace(/\r$/,'') return str.split('\r') } IsInArray = function (item,array){ for(var i=0;i
=0;i--){ if(IsInArray(allStyles[i].name,names)){ allStyles.splice(i,1); } } alert(allStyles.length + " unused styles"); Please note: If your tables are tidy header or footer, cells.everyitem () will not work. You will need to loop through the cells to build the table.
Substances
-
script to replace a paragraph style with a different styles, both within a folder
I am trying to write a script that will remove a paragraph style or character and then replace it with another paragraph or character style, both are in a folder within these groups of style. I have tried so many different scripts and that you have not found the right combination to work.
any help would be greatly appreciated! Thank you!
To target a paragraph style that is in a folder, you will have to tunnel to him through groups of styles, thus:
Style1 = app.activeDocument.paragraphStyleGroups.itemByName("Group1").paragraphStyleGroups.itemByN ame("Group2").paragraphStyles.itemByName ("myParagraphStyle");
Then find the second style (one you want to replace by):
Style2 = app.activeDocument.paragraphStyleGroups.itemByName("GroupA").paragraphStyles.itemByName ("AnotherParaStyle");
Simple and then remove the first style, replace it with the second:
Style1.Remove (Style2);
HTH,
Ariel
-
Problem deleting paragraph styles
I have a book with five documents inside. I am trying to remove the paragraph styles, but they won't go away. I continue to remove them from one of the documents, can I make the source of the document style, to synchronize other documents with her, and styles keep reappear. I tried to do with different documents, but I always get the same result.
Synchronization book removes the styles only adds.
Simply open each file (only 5 of them) and dissolving styles... they are used somewhere in the darkness.
-
Remove unused Styles using measures
Hello
I need to remove paragraph styles not used in the document by using action, until the unused style count is 0.
I saw the url below in this forum. I can do this, use the action?
remove unused styles from a single action...
Thanks in advance,
Sudha K
Hello
It won't make any change. However, please create pdf and compare with an old to check this. If my answer is correct, please mark it as correct response so that it is reference to others.
Thank you
Ramesh K
-
Remove the imported chips and replace them by paragraph Style
I imported a large number of documents to PDF and I need to remove the text format for the numbering of lettering and balls and replace them with paragraph styles. I find it difficult to arrive at a text or grep search and replace for it.
So far I managed to assign bullets paragraph style, but I can't seem to remove the imported point. This is my poor attempt a search and replace. I guess it's possible to do it also for lettering and numbering?
and that's what it looks like after the change with the ball remaining.
Good question! Can anyone chime in with the 1-step process, but it is darn fast than two, especially if you save the first query:
- Search: Bullet tab
- Change of: Para style balls
- All changes
- Click on the trash can to delete the paragraph style
- All changes
Fact.
With GREP, you might find one or several characters followed in a tab at the beginning of a paragraph (^. + ^ t) to locate any list, but you would need to set the style of bullets to bullets, the style of numbering of numbers and the AlphaNumbering style to the letters, so I don't see a benefit.
-
How can I move pages from one document to the other without merger of paragraph styles?
I want to create a singular indesign file of 2 separate documents, which allows me to make an interactive PDF of it.
However, when you move pages from one to the other, it seems that when each document has a paragraph style with the same name, they merge. The problem is that text is then adjusted if the styles do not match completely.
Is there a way to merge the documents without any formatting changes?
Create a Style group in each document and move all styles in this file. Give each document a different name. Do it with all kinds of styles: paragraph, character, objects, tables and Cell Styles. Then you can sort them later in the merged document what you do with these styles.
-
How to remove paragraph styles select only
Hi friends,
How to remove paragraph styles select only
Example:
CO_H3
COCPN
COINT1
COINTT
Line of credit
Head of design issues
Design A-Head Mtrs
Design Mtrs Hd
EOC-nl-listitem
Literate EOU continued
Thank you
Hi Karthik,
Please try this code
indesign #target
var allStyles = app.activeDocument.paragraphStyles;
var total = allStyles.length;
var arrPosition = 2;
myInput ();
myInput () function
{
var myParStylesList = app.activeDocument.paragraphStyles.everyItem () .name
var w = new window ('dialogue', ' ParagraphStyles applied: ");
var myInputGroup1 = w.add ("group");
myInputGroup1.add ('statictext', undefined, ' paragraph style: ");
myInputGroup1.alignment = 'left ';
var myDropdown1 = myInputGroup1.add ('dropdownlist', undefined, myParStylesList);
myDropdown1.selection = 1;
var myButtonGroup = w.add ("group");
myButtonGroup.alignment = 'right ';
myButtonGroup.add ('button', undefined, 'OK');
myButtonGroup.add ('button', undefined, 'Cancel');
w.Show ();
r = [myDropdown1.selection.text];
for (i = 2; I have<>
{
If (allStyles [i] .name is r)
{
allStyles [i] .remove ();
Return r;
}
on the other
{
arrPosition + 1
}
}
}
Kind regards
Barry B.
-
remove the grep in paragraph styles
Hello
I added grep styles to my para styles:
for (var i = 1; i < myParaStyles.length; i ++) {}
var myGrepStyles is myParaStyles [i].nestedGrepStyles.add ();.
myGrepStyles.grepExpression = '. '. (?=»)";
myGrepStyles.appliedCharacterStyle = myDoc.characterStyles.itemByName ("Stylename");
}
in a new version, I have to get rid of these grep styles. Replacing the stylename with "[None]" does not, and removing the style isn't a solution either, as it could is used somewhere else.
any ideas?
Thanx
You can remove GREP styles:
myParagraphStyle.nestedGrepStyles [0] .remove ();
If there are two or more GREP styles in a paragraph style, loop through them.
Peter
-
In a paragraph style of nesting "without breakage?
(My apologies if this has been requested and we have responded).
Is it possible to set my body copy paragraph style to apply automatically "without interruption" for the last two words in the paragraph?
I'm pretty good on the digitization of text in search of paragraphs that ends with a small hooked at the end Word, but it would be nice to automate it.
Another solution would be to set a minimum word count allowed on a single line. (Not useful for subtitles!)
Thank you.
I also like this one, published some time ago by another reader (sorry, I don't remember which):
1 create a character with the single attribute being without breaking Style.
2. create a new paragraph and in the GREP Style column, the menu drop-down Style "Style", choose the character style, that you just created.
3. in the box "to text", enter this: {15} $
The number in brackets (in this case 15) can be any number and represents the minimum number of characters - including spaces - appearing on the last line of a paragraph. Very convenient when you want to eliminate the orphans!
See you soon!
-Mikey
-
How can I force a paragraph style without losing the italics?
This has been annoying me for ages. I work on documents in Word, using italics for book titles, etc. and then import them into indesign. I apply a paragraph style and three out of four times the bits in italics are preserved. However, the fourth time the paragraph style does not (probably due to the presence of italics) and I have to force him to do it using Alt-click. Invariably, the italics is replaced by Roman.
It happens earlier with a bunch of notes and endnotes in a book, I'm working on and means I have to go back through each of them, manually applying italics to my books and reference titles. Is it possible to force a paragraph of note/reference style without losing the text in italics?
Thanks for your suggestions,
Tom.
I'm not sure that long-term planning is needed here.
If your only concern loses italics when importing from Word, create,.
in InDesign, an italic character style. Then do a search and replace
in the document, InDesign (once you have placed the Word file)
looking for an italics, formatting and replacing with your italics
character style.
Who will save you from losing your italic formatting.
Repeat for bold, bold italic, exponent, index and nothing else
the author uses.
There are scripts that help in this process (I think one of them is
called "preptext", by Jongware).
If you want a complete solution that can be found all types of
override setting in shape and creates and applies the appropriate character
style, check out my script "create character the Styles of overrides him."
available on the script on freelancebookdesign.com tab.
Ariel
-
Hi guys I need some help here.
I created a javascript script that will find and replace paragraph styles for the DOCFILE with indesign paragraph styles. everything works fine but the problem is that, when she applies paragraph styles, he loses all replacements the. I tried:
changetext (false);
but his does not work, this is a kind of conditional parameter that I can put in the function changetext() so that it used clear local overrides?Thank you.
Horse
Use findGrep() (or findText()) instead of changeText(). This returns an array of items found. Then, you can loop through the array and apply a paragraph style without erasing the replacements (the 2nd parameter must be false).
Example:
Main(); function Main() { var foundItem; var doc = app.activeDocument; app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING; app.findGrepPreferences.findWhat = ".+"; app.findGrepPreferences.appliedParagraphStyle = "Body text"; var foundItems = doc.findGrep(); for (var i = 0; i < foundItems.length; i++) { foundItem = foundItems[i]; foundItem.applyParagraphStyle(doc.paragraphStyles.item("Body"), false); } app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING; }
-
Failed to remove unused Styles
The inDesign CS5.5. I can't select all the styles, but the option to remove and trash can icom dimmed out and not selectable. What Miss me?
I bet that you have the "Basic Paragraph Style" selected - and this isn't trashable. Deselect by clicking the control, and then try again.
Maybe you are looking for
-
Disable selection of text when you reply to the message.
I asked this before and got a solution but I now use another computer and I can't find the old answer. It's under tools/options/advanced. I want the entire message that I answer to included in the response and not any text that happens to be selected
-
Qosmio G20 - line of dead pixels
The other night a solid line of dead pixels appeared on the left side of my screen. It just appeared out of nowhere, a yellow solid and thick 1 pixel wide line. Is there something that can be done for this? It can be repaired? I think my computer is
-
Momentum health will do the same with the free Apple Watch discovery health?
can you help me please
-
Pavilion 15-n047tx: please solve my problem I am facing bluetooth problem
HIII... I am facing a problem with bluetooth that I installed the hp site adter bluetooth driver signing bluetooth not highlighted in the Device Manager I see in other devices bluetooth connector properties so it shows driver for this device not inst
-
Yahoo's account has been hacked goes to the situation of insecurity sort of get it back?
My yahoo account when I connect said course but goes to insecurity when it goes to my mail. According to me, it's been hacked and no matter if I change the password, is anyway to recover my account?