4 Replies Latest reply on Nov 23, 2016 6:03 AM by Mnietek1

    tagged texts on a page

    Mnietek1

      How can I get all tagged texts on particular page?

      Tagged text can be located in text frames grouped with another objects.

        • 1. Re: tagged texts on a page
          Jump_Over Level 5

          Hi,

           

          Describe more what you mean by 'tagged'.

          InDesign can import or export tagged text, but inside InDesign doc (in textFrames) there is formatted text.

          How your tags looks like?

          Jarek

          • 2. Re: tagged texts on a page
            Mnietek1 Level 1

            something like that:

            tags.JPG

            • 3. Re: tagged texts on a page
              Jump_Over Level 5

              So we are talking about XML structure...

              XMLElement parent can be a document or another XMLElement.

              But...

              If you find every textFrame on your page - you can call each textFrame.texts[0].associatedXMLElements. This is an array of XMLElements - each of them has 'contents' and 'markupTag' property.

               

              Jarek

              • 4. Re: tagged texts on a page
                Mnietek1 Level 1

                So this is my try.

                Maybe someone will find this useful.

                (whose method is defined elswhere)

                 

                 

                var items = myPage.allPageItems.whose
                        (  function(item){ 
                                    return(item instanceof TextFrame) 
                        }  )
                    
                var bb, myXMLelements = []
                while (bb = items.pop()) {
                        myXMLelements = myXMLelements.concat(bb.texts.everyItem().associatedXMLElements[0])
                }
                
                myXMLelements = myXMLelements.whose(  
                        function(ob){
                                    return (ob.markupTag.name != "Story" && (ob.xmlContent instanceof Text) )
                        }  )