6 Replies Latest reply on Jan 7, 2015 8:01 AM by joinsrl

    Getting textFrames properties

    joinsrl Level 1


      I'm writing a plugin for InDesign CC, I'm trying to get some properties of a textFrame, I managed to get the font name and style, and the textframe position and dimension, but I can't find many other propeties such as alignment, outer shadow, opacity, rotation, stroke color and stroke weight.

      For the strokeWeight and strokeColor properties I get an error message:"This property isn't applicable in the actual state" (translated from italian...), and I don't understand why, for teh other propeties I have no clue of where to find them....

      Someone has some ideas?


        • 1. Re: Getting textFrames properties
          joinsrl Level 1

          I think I have found the shadow properties in  app.activeDocument.pages[0].textFrames[0].appliedObjectStyle.contentTransparencySettings. dropShadowSettings but I still can't found the other properties!

          • 2. Re: Getting textFrames properties
            cchimi Level 2

            I find it's easiest to figure out how I would change a setting in InDesign, and then try to find properties that align with that in the Object Model Viewer (from the ESTK, Help > Object Model Viewer). So, for instance, if I wanted to change the Opacity, I'd open the Effects dialog. Opacity is there, under Transparency. In the OMV there is is no "effects" property under TextFrame, but there is a TransparencySettings property which returns a TransparencySetting object. This object contains pretty much everything found in the Effects dialog: opacity, bevelAndEmboss, dropShadow, etc.


            Other properties can be found by searching and working backwards. This can be time-consuming but usually you can find what you need.


            In other words, don't expect an object to have direct properties for everything you are looking for. More complex settings are frequently nested in a separate object.

            • 3. Re: Getting textFrames properties
              joinsrl Level 1

              Hy thank's for the suggestion, I'm looking in transparencySettings, I find the bevelAndEmboss and dropShadow but I can't find opacity, what can I possibly getting wrong?

              • 4. Re: Getting textFrames properties
                cchimi Level 2

                Sorry, I skipped a step in the hierarchy. I'll just edit the original post so it's clearer.


                Ugh, this forum drives me nuts sometimes. Can't edit the earlier post, so: I forgot to mention that the Transparency Opacity setting in the Effects dialog is actually in a Basic Blending frame, and that's significant. So, since I don't see Opacity under Transparency, I look for blending. I find BlendingSettings, which returns another object, BlendingSetting, which includes an opacity property.


                So, if I have a textframe with a 46% opacity and I select it and run




                I get a return value of 46 (opacity returns a number as a percentage).


                Hope that clarifies.

                • 5. Re: Getting textFrames properties
                  Laubender Adobe Community Professional & MVP

                  @joinsrl – hm, strokeColor for a text frame should always return a Swatch object even if no color is assigned (the default). It's name should be "None" in this case. The same goes with strokeWeight. If no weight is assigned, it should return the value "0".


                  So, what has happened to your text frame?
                  A special situation? Is it really a text frame you are observing?


                  Can you elaborate on this and/or post a download link (from Dropbox or some other service) with an IDML or IDMS file with the text frame in question?



                  • 6. Re: Getting textFrames properties
                    joinsrl Level 1

                    Hy, sorry, my bad, I meant strokeWeight and strokeAlignment show the message:"This property isn't applicable in the actual state", strokeColor is actually a swatch object. Since we are talking of strokeColor, how can I get the color values? I tried with app.activeDocument.pages[0].textFrames[0].gapColor.parentColorGroup.colorGroupSwatches and from here I understand that I need to get an item, but I haven't understand wich item i should really get? If I try with everyItem() I get a list of 13-14 items when in my file I only have a textFrame with a couple of words...

                    Sorry for the confusion, it's my very first experience with InDesign.