Add Keyboard Shortcuts for Select All Unused Styles

Learn / Forums / General InDesign Topics / Add Keyboard Shortcuts for Select All Unused Styles

Viewing 7 reply threads
  • Author
    Posts
    • #61826
      Matt Mayerchak
      Participant

      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.

    • #63035
      Sheri G
      Member

      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

    • #75092
      Sheri G
      Member

      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:

      https://forums.adobe.com/message/1106498

    • #75099

      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.

    • #75130

      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

    • #75178
      Andre Vandal
      Member

      Interesting script to clean up indesign documents before archiving them. If this could clean Object Styles also it would be perfect.

    • #75201
      Aaron Troia
      Participant

      Hey Andre,

      Here is a modified version of the script that also cleans up Object Styles.

      https://dl.dropboxusercontent.com/u/14902057/RemoveUnusedStyles.jsx

    • #75203
      Andre Vandal
      Member

      A. A. RON…

      Thank you very much, it work just great. Will think of you every time I use it. :)

Viewing 7 reply threads
  • You must be logged in to reply to this topic.
>