Add Keyboard Shortcuts for Select All Unused Styles
Learn / Forums / General InDesign Topics / Add Keyboard Shortcuts for Select All Unused Styles
Tagged: script, select all unused styles
- This topic has 7 replies, 6 voices, and was last updated 8 years, 11 months ago by Andre Vandal.
-
AuthorPosts
-
-
March 19, 2012 at 9:43 am #61826Matt MayerchakParticipant
In CS 5.5 I can't set a keyboard shortcut for Select All Unused from the Paragraph Styles panel, or the Character Styles panel, either. Those commands just don't show up in the Edit Keyboard Shortcuts menu, nor in the DTP tools plugin.
I use this command frequently in production to cleanup the styles in a document. So, I opened my keyboard shortcuts .indk file in BB Edit and tried adding these commands manually. But, this did not work.
Does anybody know a way to fool Indesign into allowing us to assign keyboard shortcuts to menu items that aren't available via the Keyboard Shortcuts dialog box?
I can try Quickeys, I suppose . . . but I would much rather control it from within the application.
-
September 2, 2012 at 4:27 pm #63035Sheri GMember
I would really like to know about this as well — not just for Paragraph Styles, but for Character Styles as well. This becomes critical when making an ePub, because you really want to remove any unused styles before exporting to ePub. It makes the code clean-up process so much easier when you don't have a lot of unused styles in there.
I have Blatner Tools, too, and it won't let you make a shortcut for this, which is a crying shame.
Also sad is that no one has responded to this post yet, since this is something that many people would find useful, if it was available.
Sheri
-
April 30, 2015 at 3:35 pm #75092Sheri GMember
This script works in InDesign CS6, at least. It removes all unused paragraph and character styles with one click. Sweet:
var myDoc = app.activeDocument;
var myParStyles = myDoc.paragraphStyles;
var myCharStyles = myDoc.characterStyles;for (j = myParStyles.length-1; j >= 2; j– ) {
removeUnusedParaStyle(myParStyles[j]);
}for (i = myCharStyles.length-1; i >= 1; 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;
}This is where I found it, just in case I didn’t copy it correctly:
-
May 1, 2015 at 3:35 am #75099Kees ValkeringMember
It works also for the latest CC 2014.2 version.
In the mentioned link is also a script for deleting unused swatches which I use daily. -
May 4, 2015 at 5:24 am #75130Anne-Marie ConcepcionKeymaster
It looks like the forum code messed up the script, it replaced two dashes with an emdash!
I went to the original forum post (thank you for posting that!) and copied it from there, saved it as a javascript, tested in CC2014 … it works great.
You can download the RemoveUnusedStyles.jsx script from here:
https://creativepro.com/downloads/RemoveUnusedStyles.jsx.zip
-
May 5, 2015 at 7:45 am #75178Andre VandalMember
Interesting script to clean up indesign documents before archiving them. If this could clean Object Styles also it would be perfect.
-
May 6, 2015 at 9:25 am #75201Aaron TroiaParticipant
Hey Andre,
Here is a modified version of the script that also cleans up Object Styles.
https://dl.dropboxusercontent.com/u/14902057/RemoveUnusedStyles.jsx
-
May 6, 2015 at 11:55 am #75203Andre VandalMember
A. A. RON…
Thank you very much, it work just great. Will think of you every time I use it. :)
-
-
AuthorPosts
- You must be logged in to reply to this topic.