• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to get character count

New Here ,
Nov 20, 2011 Nov 20, 2011

Copy link to clipboard

Copied

Hi All,

How to read the below highlighted value in script. Pl help me.

Regards,

RockSelFindValue.JPG

TOPICS
Scripting

Views

18.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Nov 20, 2011 Nov 20, 2011

Hi Rock Sel,

Try the below js code.

var myDoc = app.activeDocument.pages.everyItem().textFrames.everyItem();

try{

    var myCharlength = myDoc.characters.length;

    }catch(e){}

if(myCharlength<=0){

    alert("Characters count is 0 in this document!");

    }

else{

    alert("Characters count : "+myCharlength);   

    }

thx

csm_phil

Votes

Translate

Translate
New Here ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

Your script take some time for long texts (300 pages), but it rocks !

I like the possibility to exclude hidden layers, perfect for exclude some notes in marges, just have to put them on another layer, hide it then count the total.

With your settings, the script can help for several cases.

Does it include tables ? (I think so, but I haven't some to be sure of that)

Thanks a lot,

Anthony

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

@Anthony – yes, it does count characters in tables.

And characters of tables sitting in tables.

The script uses InDesign's GREP search, so this functionality is implicitly built into.


Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines