8 Replies Latest reply on Feb 27, 2008 1:30 AM by [Jongware]

    Note #

      Hi

      How to get the number of a note from a document through scripting. On the Notes Pallete there is an info displayed as "Note No:1 of 9" if a document contains 9 Notes. I would like to display the "1". Is there any way to retreive this info.

      Thanks
        • 1. Re: Note #
          Level 1
          from VB ObjectBrowser

          Property Index As Long
          read-only
          Member of InDesign.Note
          The index of the Note within its containing object.

          robin

          --
          www.adobescripts.com
          • 2. Re: Note #
            [Jongware] Most Valuable Participant
            Checking the ESTK help, please hold -- ah, there is a Note object, with as possible parents XmlStory, Story, TextFrame, InsertionPoint, Text, Character, Word, Line, TextColumn, Paragraph or TextStyleRange. Apparently, Story is the one to work from -- I expected Document, but there you go.

            With Story as the base, you can use the notes element to access them. The total count is (obviously) Story.notes.length, and -- checking the Note object in the ESTK again, please hold -- you can try their id or index property for the "current" note number. I'm guessing either one or both are document-wide numbers, not on a per-story base.

            From here on it depends on what the input is and what you're trying to achieve. If, for example, you know the document contains several stories, each with their own set of notes, you'll have to walk from story to story and do your thing.

            Although this is the very first time I looked up the data on notes, I still had
            i no problem at all
            finding whatever I wanted to know next. I admit it doesn't answer your question directly, but you should really be able to work it out from here.
            • 3. Re: Note #
              Level 1
              Hi

              Neither id nor index helped me. I tried them already.

              Thanks
              • 4. Re: Note #
                [Jongware] Most Valuable Participant
                So, tell us what the problem is.
                i Why
                doesn't it work? What did you try already? What's the error? What did you get that you didn't want?
                • 5. Re: Note #
                  Level 1
                  Hi

                  Actually i am using
                  myDocument.pages.item(l).textFrames.item(k).paragraphs.item(i).notes.item(j).texts.item(0) .contents

                  to display all the info
                  now i would like to display the note number

                  i have one more Question
                  how can i navigate through the notes in a document using stories.
                  • 6. Re: Note #
                    [Jongware] Most Valuable Participant
                    Ah -- it seems you're iterating over (1) pages, (2) textframes, (3) paragraphs, (4) notes, in that order.

                    But see my earlier note (pun) on the possible parent items -- that includes Story. So, if all your notes are in a single story, you can iterate directly from this. If you have more than 1 single story containing notes, you can iterate over all stories in your document. That means just two loops, not four.

                    There must be
                    i some
                    rationale to the note numbering, i.e., either it is one of its id or index -- it must be a
                    i global
                    numbering, continuing over all stories -- or, if you start at Story #1, then the first note in there is #1, up to the number of notes in there, and continuing with the next story up to the end.
                    • 7. Re: Note #
                      Level 1
                      Hi

                      with the below statment i am able to count the number of notes

                      myDocument.stories.item(s).notes.length;

                      myDocument.stories.item(s).pragraphs.item(p).notes.item(n).userName;

                      with the above statement i not able to iterate though each note.
                      • 8. Re: Note #
                        [Jongware] Most Valuable Participant
                        ? Never heard of the JavaScript loop construct?