14 Replies Latest reply on Dec 19, 2012 2:34 AM by Peter Kahrel

    Print notes from InDesign CS4

    jay fresno Level 1
      I just upgraded to InDesign CS4 and was hoping that Adobe would have added a feature to print the notes from an InDesign file, but haven't seen any such thing. Does anyone know of a script that would allow InDesign to print notes?
        • 1. Re: Print notes from InDesign CS4
          Peter Kahrel Adobe Community Professional & MVP
          This one places the contents of all notes in a new document:

          n = app.activeDocument.stories.everyItem().notes.everyItem().texts[0].contents;
          
          tf = app.documents.add ().textFrames.add
             ({geometricBounds: ['10mm','10pt','250mm','200mm']});
          tf.contents = n.join ('\r\r')


          Peter
          • 2. Re: Print notes from InDesign CS4
            jay fresno Level 1
            Peter,

            Thank you for this! Your script works great. I feel like you are a genie who granted my wish.
            • 3. Re: Print notes from InDesign CS4
              jay fresno Level 1
              Peter,

              Is it possible to add a page number to the note to help identify the note?

              (By the way, I bought a copy of your book: GREP in InDesign CS3. It's very clearly written. Hope to get some time soon to dedicate to reading it more thoroughly.)
              • 4. Re: Print notes from InDesign CS4
                Peter Kahrel Adobe Community Professional & MVP
                Here you go. It finds notes in tables as well. It ignores notes in inline frames.

                Peter

                (Glad you like the GREP title. There's a CS4 version, by the way.)

                #target indesign;
                

                array = [];
                notes = [];

                // notes in main stories
                notes = app.activeDocument.
                   stories.everyItem().
                   notes.everyItem().getElements();

                // notes in tables
                try {notes = notes.concat (app.activeDocument.
                         stories.everyItem().
                         tables.everyItem().
                         notes.everyItem().getElements())} catch (_){};

                for (i = 0; i < notes.length; i++)
                   try {array.push (notes[i].texts[0].contents +
                         ' [' + notes[i].storyOffset.parentTextFrames[0].parent.name +']')} catch (_){};

                tf = app.documents.add ().textFrames.add
                   ({geometricBounds: ['10mm','10mm','250mm','200mm']});
                tf.contents = array.join ('\r\r')
                • 5. Re: Print notes from InDesign CS4
                  jay fresno Level 1
                  Peter,

                  Thank you for adding the page numbers -- works perfectly!

                  Regarding your book, are there many changes in GREP from InDesign CS3 to version CS4?
                  • 6. Re: Print notes from InDesign CS4
                    Peter Kahrel Adobe Community Professional & MVP
                    Jay,

                    Some passages were rephrased to make them clearer. For instance, the difference between lazy operators and negative classes could do with some clarification. I also added some examples here and there, and described a new feature in CS4, GREP styles. Finally, I added a short section on how you can chain saved queries using very simple scripts. I didn't know that one when I wrote the CS3 edition -- jongware spotted it and mentioned it in this forum a while ago.

                    Something that didn't make it into the CS4 edition is that CS4 supports Unicode properties and sub-properties (of the form \p{..}, see Friedl, "Mastering Regurlar Expressions", pp. 122, 123). For example, there is a property \p{P} that matches punctuation. This one has several subproperties (\p{Pd} matches all kinds of dashes, \p{Po} captures opening punctuation, there are several others). All in all there are 37 Unicode properties.

                    They didn't make it into the CS4 edition because Adobe is sometimes a bit shy about telling us what new features they implement -- Unicode properties was one of them. I tried these in CS3, but forgot to do that in CS4. A correspondent in France pointed it out to me.

                    I've now put together an overview of these new properties at http://www.kahrel.plus.com/indesign/grep_mapper.html There's a script there that generates selected Unicode ranges and lets you map any GREP wildcard on the selected range.

                    Peter
                    • 7. Re: Print notes from InDesign CS4
                      jay fresno Level 1
                      Peter,

                      Thank you for your thorough explanation and comparison of your GREP in InDesign CS3 and CS4 books. I'm going to download the CS4 version this afternoon.

                      I've recommended your book to a number of InDesign users. It's a great way for both 'techies' and 'non-techies' to get a handle on taking advantage of GREP in InDesign.
                      • 8. Re: Print notes from InDesign CS4
                        Peter Kahrel Adobe Community Professional & MVP
                        Thanks, Jay.
                        • 9. Re: Print notes from InDesign CS4
                          Can you give novice me specific steps to install these scripts? I copied and pasted them into TextEditor (plain text) then saved as both .applescript and .as and put them in the scripts folder but when I try to run them, I get an error. Any ideas and thanks so much!
                          • 10. Re: Print notes from InDesign CS4
                            [Jongware] Most Valuable Participant
                            >... saved as both .applescript and .as ...

                            Sounds about right -- up to here, since Peter's scripts are JavaScript, not AppleScript. Use ".jsx" as the file extension and you'll be allright, I guess.
                            • 11. Re: Print notes from InDesign CS4
                              Level 1
                              Thank you so much jongware. Absolutely right, and it's perfect. Thanks to all, and Peter, especially, for making us all look like, well, stars! Yipee!
                              • 12. Re: Print notes from InDesign CS4
                                Level 1
                                How would the notes script look if you wanted all notes to be available including inline ones and page numbers?
                                • 13. Re: Print notes from InDesign CS4
                                  CarlosFMeneses

                                  I wasn't able to get the page numbers to print along with the notes in InDesign CS5. I did some poking around and was able to modify your script. Hope you don't mind.

                                   

                                  - Carlos F. Meneses

                                   

                                  --- Start Copy and Paste Below ---

                                   

                                   

                                  #target indesign;
                                  array = [];
                                  notes = [];
                                  // notes in main stories
                                  notes = app.activeDocument.
                                     stories.everyItem().
                                     notes.everyItem().getElements();
                                  // notes in tables
                                  try {notes = notes.concat (app.activeDocument.
                                           stories.everyItem().
                                           tables.everyItem().
                                           notes.everyItem().getElements())} catch (_){};
                                  for (i = 0; i < notes.length; i++)
                                     try {array.push (notes[i].texts[0].contents +
                                           ' [' + notes[i].storyOffset.parentTextFrames[0].parentPage.name +']')} catch (_){};
                                  tf = app.documents.add ().textFrames.add
                                     ({geometricBounds: ['10mm','10mm','250mm','200mm']});
                                  tf.contents = array.join ('\r\r')
                                  
                                  • 14. Re: Print notes from InDesign CS4
                                    Peter Kahrel Adobe Community Professional & MVP

                                    Indeed, page.parent behaves differently in CS5, and parentPage is a property introduced in CS5. Thanks for posting the updated version.

                                     

                                    Peter