You can use the Find/Change feature to find the font style. The following script would do that
app.findTextPreferences = NothingEnum.nothing; app.findTextPreferences.fontStyle = "Bold" var find = app.activeDocument.findText (); app.findTextPreferences = NothingEnum.nothing; alert("Found " + find.length + " occurence")
Yeah! It's shows the bold text count. I have an another doubt (for.eg., In InDesign document i have contents with bold text and unbold text in a same textframe by using the script i need to fetch all texts in the InDesign document without missing the bold text and unbold text is it possible)
I have an another problem the code that you have given displays the count of bold text. How to display the content of the bold text i have tried but it shows undefined. Please guide me
I did not quite follow what you want, to get all the text of the document you could use the following code. It does not care about the formatting applied to the text
To get the content of a textframe you need to refer its contents property
ok 1'll explain you what i'm trying to do is, I have generated an xml including <bol></bol> tag for some text. After drag and drop the contents from xml in InDesign document the text included in <bol></bol> tag gets bold. But, in our plugin after using liveupdate the bold tag disappears in the database but it present in the xml. i don't know what to do with it. i'm searching to do liveupdate with all tags that applied in the xml must apply to the database. Is there ia a way??? The reason i have asked about the scripting is to check wheather i can get the document contents with applied styles or not..