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

Tags: InDesign

Similar Questions

  • 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

  • How to remove unused files from my account site live hotmail?

    original title: unused files

    How to remove unused files from my account site live hotmail?

    The question you have posted is bound using Windows Live (hotmail) and would be better suited to the Windows Live Help Solution . Please visit this link to find a community that will provide the support you want.

  • How to remove unused objects from the webcatalogs?

    Hi friends,

    How to remove unused objects from the webcatalogs?
    is there a utility like the removal of unused objects of the physical layer in RPD?

    Thank you

    Hello

    Click link responses to the left of the answers click on the catalog button manage manage catalog, you can delete the unused objects

    Concerning

    NGO

  • How to remove unused readers from the Explorer

    Under 'Computer' in the Solution Explorer, I have the following discs I want to remove and have no idea how to go to delete them because I don't know what some of them are: removable F: Drive; Compact Flash H:; SmartMedia I:' MS/MS Pro J:; Removable drive K:. CD player (l) Smartdrive WD and my book of K.  The only drive I want to keep is the My Book, and I would like to be known as F: drive.  Can someone provide advice?  Thank you, Terri

    Hi TerriDelaware,

    1. What are the external devices connected to the computer?

    2. on what drive you have Windows installed?

    3 is the drive for CD (L) a drive internal or external?

    Removable disks sometimes appear in computer even if they are disconnected. I suggest that you restart the computer and check if it works.

    You will first need to know what contain all readers and what they are.

    Unless you delete or change the F drive on the computer, you cannot apply the letter F for the my book drive.

    You may need to take the local computer tech shop to find out what are all the readers and to remove them from the computer.

    For more information on changing drive letters refer to the link below.

    Change, add, or remove a drive letter

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-add-or-remove-a-drive-letter

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • 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.

  • Remove unused styles

    Hi all

    Is it possible to look through a site and find all the CSS rules that are used and then delete unused rules to a set of style sheets?

    Thanks for any idea.

    In a Word, no. This would be a useful feature, but there is nothing of that nature built into Dreamweaver. Personally, I use the Audit to the Chrome Developer Tools tab to to deal with this.

  • How to remove unused items from the library?

    Dear all,


    Flash CS4 is really good for the design and development of point of view. But I noticed two things:

    1. If the library has more point so there is no option on right click "select unused items". How can I get this option "select unused items" on click right while the library has one more items with the scroll bar?
    2. Height of the window actions sometimes increased. Right now there is no option to decrease the height of the window actions except the Reset option.

    Please let me know if I'm wrong!

    See you soon

    Uday Singh

    SR. ActionScripter

    [email protected]

    Why can't you use the library Panel Options option?

    -kumslee

  • How to properly install shield so I can remove unused programs from my system?

    How I have difficulty or install the component 'install sheild' in my system so I can delete unwanted programs?

    Thank you for your answer to my question.  The software, I'm trying to delete is Illimina. The steps I am taking are; got to control panel, click Add/Remove programs and click on the program to remove.  Once I click on the program - it starts to boot and then stops.  Immediately after the stop, a message appears on the screen that reads, "engine InstallShield (ikernel.exe) could not be launched.  Without this interface supported. "  Let me add that I have not used this laptop since 2004.  I downloaded all the necessary updated and improved to explore 8 and still get the same results.  I hope that's enough detail, if it not is not please let me know.

    Thanks again for your response.

    Thanks for providing the information.

    I'm afraid I can't give you a specific patch.  Often, application uninstalling problems can be cured by the re-installation of the application and then uninstall.  In addition, InstallShield usually directs users having problems with the Publisher of the application are installed or uninstalled. I did not, however, any application, called "Illimina", and he could no longer exist.

    It's the advice given by InstallShield to treat the error message you received:http://consumerdocs.installshield.com/selfservice/viewContent.do?externalId=Q108521&sliceId=1 I suggest you on the 5 "troubleshooting steps" listed at the bottom of the document.

    If the update of iKernal does not work, see http://consumerdocs.installshield.com/selfservice/viewContent.do?externalId=Q108322&sliceId=1 unfortunately, this document assumes that you have the software installation program in order to determine which version of the InstallShield engine for download and reinstall.  You may be able to find an uninstaller or the installation with the version information file in the directory C:\Program Files\ for Illimina, but it's not likely.

    Finally, try to uninstall the application free Revo Uninstaller using - but your application may have been installed with technology that predates the information Revo includes how to use.

  • several actions from linking single action

    OBIEE 11.1.1.6

    I have a column in an analysis that I had to put a link to action on the link to a Web site, it's something I can do. However the data returned in the column is one of the two types of Type A or B, if it is of type that I want to link to the Web site A and Type B I want to link to site B. I want to create a link simple action that is going to the site A or site b according to the values in the column. I can create an individual to either site has action link or B and add a condition, but I can't think how to add a unique action link that will dynamically to a Web site or the other based on the value of the column. Is this possible?

    Published by: K Chumpski on November 27, 2012 07:05

    Hello
    You can navigate to several links of action action unique bond based on the conditions...

    check if useful/correct...

    Thank you
    prassu

  • Remove unused workspace from the workspace switcher

    Some areas of work that comes with Photoshop are not useful for me.  Is there a way to delete preinstalled wokspaces starting from the switch to the workspace?

    Have you tried that?

  • How to remove unused applications from the main screen Centro?


    You're right, these applications cannot be deleted.  The best you can do is hide using a freeware application called 'hide '.  Simply, it hides the icons, but does not delete the application.

    Message relates to: None

  • Remove unused files from a project of EI

    I'm trying to clean up a file on a hard disk that contains the files used in my AE project. Is there an easy way to see which files are not used in it?

    This page may give you some ideas. http://help.Adobe.com/en_US/AfterEffects/9.0/WS3878526689cb91655866c1103906c6dea-7fa7a.htm l

  • Remove the unused characters from string

    Hi, I try to remove unused characters from a string, but I can't find a function for this.

    The string like: 0000 0000 0000 0000 0000 0000 0130 3130 3030 3030 3004 0000 0000 0000 0000 0000 0000 0000, I need the characters from 01 to 04.

    I need some advice.

    If the characters between the SOH and EOT had a NULL value, then Match Regular Expression can be a choice:

    Find \x01, find something else THAN \x04, then find \x04

  • 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").

    Screen shot 2015-10-12 at 3.27.12 PM.png

    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]);
        }
    }
    

Maybe you are looking for

  • What should I do when my iphone is locked, but is missing

    I recently lost my iphone and I locked so that they won't get on that, but I need to know where the iphone is perhaps.

  • Satellite A40-221 - where to find the drivers for Windows XP?

    Hello everyone. I hope someone here can help me with my problem. I have old Toshiba laptop - Toshiba Satellite SA40-221, here it's picture . I reinstall windows xp and now I can't find the drivers. I have search on the official Toshiba web page and o

  • Should I buy protection screen on Amazon

    I found a few less expensive protective screen on Amazon and Ebay. I want a glass screen protector. Should I buy a Zagg for $35? Should I buy the Zagg cheap on Amazon? Should I buy it at Best Buy or at Apple? I need help to buy the best protective sc

  • International usability

    Currently living in Iceland, I take my vacation in the USA and I am very intrigued by the razr maxx. My question is, I'll be able to use it in my country of origin if I buy it in the United States? CurrentY I identify my account by SIM card.

  • Differences between the HP Deskjet 3522 and HP Deskjet 3520?

    Hello Is could someone please tell me what is the difference between the HP Deskjet 3522 and HP Deskjet 3520? I've seen both for sale online and can see no difference between them... so don't know why different model numbers Thank you!