2 Replies Latest reply on Aug 10, 2009 2:12 AM by Ildhund

    Find a duplicate story

    masc145 Level 1

      We are a newsletter, we need to find, if we have a duplicate story in the newsletter.

      we are thinking grab a first paragraph from some text frame and compare it with the rest first paragraph of all the text frames in the document.

      If  we find a duplicate, show them where.


      Is this posible to make a scritp?

      Are there any ideas how to do that?


      Thank´s in advance

        • 1. Re: Find a duplicate story
          Kasyan Servetsky Level 5

          Here is the first (basic) version of the script:


          var myDoc = app.activeDocument;
          var myTextFrames = myDoc.textFrames;


          for (i = 0; i < myTextFrames.length; i++) {
              var myTextFrame1 = myTextFrames[i];
              for (j = myTextFrames.length-1; j >= 0; j--) {
                  var myTextFrame2 = myTextFrames[j];
                  if (myTextFrame1.id != myTextFrame2.id && myTextFrame1.paragraphs[0].contents == myTextFrame2.paragraphs[0].contents) {
                      try {
                      catch (myError) {}
                      alert("A duplicate story has been found.");


          alert("No duplicate stories have been found.");


          If duplicate text frames are on the same spread, the script select both of them; if not, only one of them.


          • 2. Re: Find a duplicate story
            Ildhund Level 3

            I was in the same situation. I adapted the ExportAllStories script so that the file name of each exported file consisted of the issue number (part of the ID file name), the page number and the first few words of the story to a maximum of 50 characters. To exclude short stories (separately placed headlines, for example) I restricted the export to stories over 50 characters in length.


            I can quickly see if a story was duplicated, and I can use the exported stories to generate a multiple-issue index - for a year, or indeed several years.