3 Replies Latest reply on Sep 5, 2011 8:38 PM by John Hawkinson

    ObjectExportOption

    michaelfielitz

      Hello,

       

      I need to tag page items programmatically with JavaScript, but have no idea how to achieve it.

      Does anyone can give me some hint about how to fill out the missing lines in the following code:

       

           var myPageItems = myDocument.pages.item(myCounter).pageItems;

           for(i = 0; i < myPageItems.length; i++){

                var item = myPageItems[i];

                [...]

                ObjectExportOption.applyTagType = TagType.TAG_ARTIFACT;

       

      The following line in AppleScript at least changes Picture Frames in the desired manner:

       

           set apply tag type of object export options to tag artifact

      Thank you,

      Michael

        • 1. Re: ObjectExportOption
          John Hawkinson Level 5

          Ah, this is new in CS5.5, I guess it is epub related?

           

          I think you want item.objectExportOptions.applyTagType = TagType.TAG_ARTIFACT;

          • 2. Re: ObjectExportOption
            michaelfielitz Level 1

            Hi,

             

            of course this is epub related. Your snippet works for picture frames. But I need to tag text frames as well (for instance the ones, that have no attached article). This is possible from the user interface, but doing so programmatically, I get the error message "object does not support the property or method".

            I guess, there is still sth. concerning the object hierarchy that I do not understand yet. I mean, iterating over all page items is one thing. And applying the right filter the other part of the story – am I right?

             

            Michael

            • 3. Re: ObjectExportOption
              John Hawkinson Level 5

              I think you are essentially out of luck. It appears to be an omission from the object model that you cannot access the ObjectExportOptions of a text frame.

              The following procedure appears to be successful, however; I am not sure there is a practical adaptation of it:

               

              >> r=app.selection[0]
              [object TextFrame]
              
              >> r.contentType
              1952412773
              
              >> r.contentType=ContentType.GRAPHIC_TYPE;
              Error: contentType
              >> r.contentType=ContentType.UNASSIGNED
              Error: contentType
              >> r.contentType=ContentType.TEXT_TYPE
              1952412773
              
              >> r.contents
              adsfdasfadsfds
              
              >> r.contents=""
              
              
              >> r.contentType=ContentType.GRAPHIC_TYPE;
              1735553140
              
              >> r
              [object TextFrame]
              
              >> app.selection[0]
              [object Rectangle]
              
              >> r.toSpecifier()
              /document[@id=1]//text-frame[@id=225]
              
              >> app.selection[0].toSpecifier()
              /document[@id=1]//rectangle[@id=225]
              
              >> q=app.selection[0]
              [object Rectangle]
              
              >> q.objectExportOptions.applyTagType
              1952928613
              
              >> TagType.TAG_ARTIFACT
              1952924006
              
              >> q.objectExportOptions.applyTagType=TagType.TAG_ARTIFACT;
              1952924006
              
              >> q.objectExportOptions.applyTagType
              1952924006
              
              >> r.contentType=ContentType.TEXT_TYPE
              1952412773
              
              >> r.contents="pizza"
              pizza