Skip to main content
Divya DR
Participant
May 8, 2026
Question

How to Detect Mixed Tracking Values in Paragraphs Using InDesign Scripting

  • May 8, 2026
  • 1 reply
  • 30 views

Hello,

I need to find tracking for each paragraph. I change tracking size inbetween paragraph it shows null(empty) in indesign but in script even the tracking value mixed, it shows 0. I need the validation through script to find which page and which paragraph tracking is mixed. then i tried textStyleRanges, through stories and texts it wont work.

 

    1 reply

    Peter Kahrel
    Community Expert
    Community Expert
    May 8, 2026

    > then i tried textStyleRanges, through stories and texts it wont work.

    Not sure what you mean by this. Anyway, textStyleRanges is definitely the way to go. Something along these lines:

    par = app.documents[0].stories.everyItem().paragraphs.everyItem().getElements();

    for (i = 0; i < par.length; i++) {
    // This returns an array of values. Check whether
    // the values are the same
    track = par[i].textStyleRanges.everyItem().getElements();
    }

    So first you collect the paragraphs in your document. Then in each paragraph, get the tracking values of the paragraph’s textStyleRanges. If you use the method I sketched you get an array. Then all you need to do is to check whether all the array values are the same.