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

How to spot duplicate paragraphs

New Here ,
Sep 11, 2022 Sep 11, 2022

Copy link to clipboard

Copied

Hey there,

I was wondering if it exists a plugin or a GREP code i could use to spot duplicate paragraphs in a indd document. thank you!

 

TOPICS
Scripting

Views

69

Likes

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 ,
Sep 11, 2022 Sep 11, 2022

Copy link to clipboard

Copied

Do you mean sequential duplicates, one after the other, or ones that might be anywhere in the document? The first is trivial, even without a script or such, but the second approaches low-grade AI, I think.

 

If this is something you have to do a lot, a script could probably be found or created. If it's a one time thing, or an infreequent one, I'd just use Find/Change set to find the end of each body text paragraph. (Limit it to the body text style, by name, and search for Paragraph End+Any Character — ^p^?. This will find only body content and skip last paragraphs, and should position the cursor/view right at the beginning of each paragraph.)

 

Then just search through, one quick click per paragraph, and watch for identical beginnings. This will be tedious, but you can be done with it in less time than tinkering a script or elaborate search into working correctly.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

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 ,
Sep 11, 2022 Sep 11, 2022

Copy link to clipboard

Copied

Hi @-BOZ-:

 

Showing us an example or two would be helpful. In the meantime, I found these two posts on the topic. Do either help?

 

~Barb

Likes

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 ,
Sep 11, 2022 Sep 11, 2022

Copy link to clipboard

Copied

LATEST

A fun exercise. A very rudimentary approach might be: 

var ps = app.activeDocument.stories.everyItem().paragraphs.everyItem().contents.sort();
var i = ps.length -1;
var msg = "";
var c;
var count = 0;
while (i--) {
    c = ps[i];
    if (!c) continue;
    if (c == ps[i+1]) {
        msg += c + "\n";
        count++;
    }
}
alert(count + " dupes found:\n" + msg);

 Obviously would need lots of refinement, and would probably take forever on a long doc. 

Likes

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