You could reduce the scope of the find like searching each story or text frame rather than the whole document. That could speed up the process, as it would have to find less amount of data, if not found only then you move ahead to the next story or text frame for a particular paragraph or character style.
Hi Senthilvel S,
If you don't mind using menu commands you could do:
With that script snippet you cannot tell if paragraphStyles named "$ID/NormalParagraphStyle" is used.
If you detect paragraph styles by looking at the text, so you detect the ones that are applied to the text only.
You will not find the ones that other styles are based on. You cannot e.g. remove the "unused" ones without changing the other ones, the applied ones ( if you have that in mind at all ).
What do you like to do with the unused styles?
Thanks for your response. But I don't want to delete the Unused styles, because we may use that unused styles in revises stage. Instead of delete, is there any other way to store that unused style names in the text file.
Thanks & Regards,
Hi Senthilvel S,
with my suggestion you delete the unused ones only temporarily.
Just get the allParagraphStyles and allCharacterStyles array before and after removing the unused styles.
Then undo or close the document without saving and open it again.
You could extract the id numbers of the styles in a first step from the arrays.
And you can extract the id numbers in the second step from the array after removing the unused styles.
Compare the two arrays to get a list of the unused ones.
In a report note the id numbers together with the names, because one could have two or more styles with the same name, if the styles are located in different style groups.