5 Replies Latest reply on Jul 6, 2009 1:34 AM by suresh_ed

    Indesign Processing instuction

    suresh_ed Level 1

      Is there any way to get Indesign Processing Instruction insertion point?

        • 1. Re: Indesign Processing instuction
          Dave Saunders Level 4

          Do you mean you want to get a reference to the currently selected insertion point?


          If so:


          myIP = app.selection[0];


          does that for you, but it works only if there is indeed a selected insertion point.


          If you want to check that it is an insertion point, then first you need to check that there is even a selection at all. And, there can't be a selection unless there is a document. So:


          if (app.documents.length > 0 &&

               app.selection.length === 1 &&

                    app.selection[0].hasOwnProperty("baseline")) {

               // there is a selection and it is text, so:

               myIP = app.selection[0].insertionPoints[0];



          Is that what you want? This is JavaScript. You didn't say which language you were using. I'm not sure that there is an analog to the "hasOwnProperty("baseline") method in the other languages.



          • 2. Re: Indesign Processing instuction
            Dirk Becker  Level 4

            Processing instructions are less-known citizens of the XML world.



            The following snippet takes an arbitrary XML element - the document root - and adds a processing instruction.


            A short look at the ESTK data browser shows that this processing instruction has an  associated insertion point named "storyOffset".


            var root = app.activeDocument.xmlElements.item(0);

            var myPI = root.xmlInstructions.add("target","data");

            alert( myPI.storyOffset.constructor.name);




            • 3. Re: Indesign Processing instuction
              Dave Saunders Level 4

              Thanks Dirk.


              Now I can make sense of the question!



              • 4. Re: Indesign Processing instuction
                suresh_ed Level 1

                Let me explain breifly.


                My sample Xml.

                <B>boy <?Addinfo <BInfo>Good Boy</BInfo>?> </B>

                If you check in the Element B, there is a processing insturction Called Addinfo. I want to get that PI insertionpoint.
                We can get its parent insp which is element B. But how to get its PI Addinfo Insp.



                Please suggest.

                • 5. Re: Indesign Processing instuction
                  suresh_ed Level 1



                  Can we get the PageNo using PI's StoryOffset.