4 Replies Latest reply on Mar 8, 2010 8:18 AM by robert_underwood

    Help with Notes Script

    robert_underwood

      Hello,

       

      I have a notes script that looks for all notes in a document and outputs them all to a text file. It will look for notes in inline text frames, anchored objects, and regular text frames. However, it can't find notes that are in tables or overset text. Could anyone give me a hand? I have attached the script for your review.

       

      Thanks,

      Rob

        • 1. Re: Help with Notes Script
          robert_underwood Level 1

          ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////

           

          /* Notes Script

           

          */

           

          ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////

           

          function myExportNotes(myFolder)

           

          {

           

              for (i=app.activeDocument.groups.length-1;i>=0;i--)

           

                  app.activeDocument.groups[i].ungroup();

           

              for (i=app.activeDocument.textFrames.length-1;i>=0;i--)

           

              {

           

                  if (app.activeDocument.textFrames.item(i).locked=='true')

           

                      app.activeDocument.textFrames.item(i).locked='false';

           

              }

           

              var DName=myDocument.name.replace(".indd","");

           

              var myFilePath = myFolder + "/" +DName+"_Notes "+".txt";

           

              var myFile = new File(myFilePath);

           

              myFile.open("w");

           

              myFile.write("#\tPage\tUsername\tCreated Date\tModified Date\tNotes\n");

           

              //Collect Info About Notes

           

              var mypages=myDocument.pages.length;

           

              for(p=0;p<mypages;++p)

           

              {

           

                  for (t=0;t<myDocument.pages.item(p).allPageItems.length;++t)

           

                  {

           

                      if(myDocument.pages.item(p).allPageItems[t].constructor.name=="TextFrame")

           

                      {

           

                          for (i=0;i<myDocument.pages.item(p).allPageItems[t].paragraphs.length;++i)

           

                          {

           

                              for (j=0;j<myDocument.pages.item(p).allPageItems[t].paragraphs.item(i).notes.length;++j)

           

                              {

           

                                  count=1;

           

                                  if(x<=notecount)

           

                                  {

           

                                      x=x+1;

           

                                      myFile.write(x+"\t");

           

                                      try

           

                                      {

           

                                          myFile.write(String(myDocument.pages.item(p).name)+"\t");

           

                                      }

           

                                      catch(myError)

           

                                      {

           

                                          alert("Page Number not found for Note "+ x);

           

                                          myFile.write("NIL"+"\t");

           

                                      }

           

                                      myFile.write(String(myDocument.pages.item(p).allPageItems[t].paragraphs.item(i).notes.ite m(j).userName)+"\t");

           

                                      var str1=String(myDocument.pages.item(p).allPageItems[t].paragraphs.item(i).notes.item(j).cre ationDate);

           

                                      var str2=str1.replace("GMT-0400","");

           

                                      str2=str2.replace("GMT-0500","");

           

                                      str2=str2.replace("GMT+0530","");

           

                                      myFile.write(str2+"\t");

           

                                      var str1=String(myDocument.pages.item(p).allPageItems[t].paragraphs.item(i).notes.item(j).mod ificationDate);

           

                                      var str2=str1.replace("GMT-0400","");

           

                                      str2=str2.replace("GMT-0500","");

           

                                      str2=str2.replace("GMT+0530","");

           

                                      myFile.write(str2+"\t");

           

                                      myFile.write(myDocument.pages.item(p).allPageItems[t].paragraphs.item(i).notes.item(j).te xts.item(0).contents+"\n");

           

                                  }

           

                              }

           

                          }

           

                      }

           

                  }

           

              }

           

              myFile.execute();

           

          }//function ends

           

          if(app.documents.length!= 0)

           

          {

           

              var myDocument=app.activeDocument;

           

              var notecount=0;

           

              var x=0;

           

              var myStories=myDocument.stories.length;

           

              for(s=0;s<myStories;++s)

           

                  notecount=myDocument.stories.item(s).notes.length+notecount;

           

              if(notecount==0)

           

              {

           

                  alert("There are no Notes in the Document", "Notes");

           

                  exit();

           

              }

           

              var myFolder = Folder.selectDialog ("The Report will be stored in the below selected folder", "The Report will be stored in the below selected folder");

           

              if(myFolder != null)

           

              {

           

             

           

              myExportNotes(myFolder);

           

              alert("Script Executed Successfully !!!", "Notes");

           

              }

           

          }

           

          else

           

          {

           

          alert("Please open a document and try again.", "Notes");

           

          }
          • 2. Re: Help with Notes Script
            Peter Kahrel Adobe Community Professional & MVP

            If you know who wrote that script, ask them.

             

            Peter

            • 3. Re: Help with Notes Script
              Harbs. Level 6

              If you want overset notes, you need to work by the story, rather than 

              by the page.

               

              You can get the notes in tables by using 

              myThingamagig.tables.everyItem().cells.everyItem().notes

               

              Harbs

              • 4. Re: Help with Notes Script
                robert_underwood Level 1

                Thank you Harbs!