6 Replies Latest reply on Feb 10, 2016 1:12 AM by Loic.Aigon

    Reading properties on textframes

    Bo Dudek

      Hi

       

      I need to be able to get the background color and background image of a textframe using scripting. I can't find anything in documentation about this. Suggestions?

       

      Also, I need to test if one or more textframes are linked together. Suggetions?

       

      Thanks in advance

      Bo Dudek

      Webdeveloper

      Mediegruppen

        • 1. Re: Reading properties on textframes
          Peter Kahrel Adobe Community Professional & MVP

          To test if a text frame is linked to another one, use nextTextFrame and/or previousTextFrame:

           

          if (myFrame.nextTextFrame === null && myFrame.previousTextFrame === null) {
            // the frame is not linked to another frame
          }
          

           

          Background colour: myFrame.fillColor

           

          Background image of a text frame: is that an image behind a text frame?

          • 2. Re: Reading properties on textframes
            Loic.Aigon Adobe Community Professional

            Hi Bo,

             

            Is it possible you want to get background fill or image to analyze contrast and text readibility ?

             

            In this case, there isn't such feature that I know of.

             

            Loic

            • 3. Re: Reading properties on textframes
              Bo Dudek Level 1

              @pkahrel

              Thanks - no need for images, only colour, so your answer is, what I was looking for.

               

              @Loic.Aigon

              Nope, not needed at all. Thanks anyway.

               

              I actually did forget something: I also need to vector graphics are inserted into the textframes, as our graphic department in most cases create a textframe and then inject a small piece of vector art inside like a speechbubble or equal. Suggestions here?

               

              Thanks in advance

              Bo Dudek

              Webdeveloper

              Mediegruppen

              • 4. Re: Reading properties on textframes
                Peter Kahrel Adobe Community Professional & MVP

                > vector graphics are inserted into the textframes

                 

                myFrame.rectangles

                • 5. Re: Reading properties on textframes
                  Laubender Adobe Community Professional & MVP

                  I also need to vector graphics are inserted into the textframes, as our graphic department in most cases create a textframe and then inject a small piece of vector art inside like a speechbubble or equal. Suggestions here?

                   

                  Hi Bo,

                  do you want to know, how many vector graphics are in the text frame?
                  Or do you just to know if any graphics are in the text frame?

                  Or any anchored graphic frames (with or without graphics)?

                   

                  The following code will give you an array of every graphic in the text frame.
                  Also the ones that are more deeply nested (in groups, pasted inside a frame that itself is anchored, in tables, also in footnotes):

                   

                  var myGraphicsArray = textFrame.texts[0].allGraphics; // returns an array you can loop through
                  

                   

                  If the text frame is overset, graphics that belong to the overset part of the text are not in that array.

                   

                  Uwe

                  • 6. Re: Reading properties on textframes
                    Loic.Aigon Adobe Community Professional

                    Indeed it might be wiser to look at all possible pageItems within the story. Vectors could be polygons as well.