3 Replies Latest reply on Sep 13, 2009 2:57 AM by [Jongware]

    [JS][CS3] Applying an Object Style

    Roy Marshall Level 1

      Hi.

       

      This is a simple one, I am trying to apply an already made Object Style to a text frame.

      I am using a similar method as used to apply a paragraph style:

       

       

      myFrame.appliedObjectStyle.name= "GreenBox";

      and also
      myFrame.appliedObjectStyle= "GreenBox";

       

      But these dont work.

       

      I have researched the forums and found something like:

       

      myFrame.applyObjectStyles(GreenBox , true);

      and

      myFrame.applyObjectStyles(GreenBox);

       

      but these dont work either.

       

       

      Can someone give me a hand with the correct syntax please?

       

      Thanks in advance

       

      Roy

        • 1. Re: [JS][CS3] Applying an Object Style
          AdobeScripts Level 3

          Roy Marshall wrote:

           

          I have researched the forums and found something like:

           

          myFrame.applyObjectStyles(GreenBox , true);

          and

          myFrame.applyObjectStyles(GreenBox);

           

          but these dont work either.

           

          the problem is in S after applyObjectStyle ... should be applyObjectStyle - without S at end

           

          robin

           

          www.adobescripts.co.uk

          • 2. Re: [JS][CS3] Applying an Object Style
            Roy Marshall Level 1

            I have just answered this by finding another thread...

            myFrame.applyObjectStyle(app.documents[0].objectStyles.item("GreenBox"), true);
            I would like to know what the 'True' means though.
            Any thoughts?
            Cheers
            Roy

            • 3. Re: [JS][CS3] Applying an Object Style
              [Jongware] Most Valuable Participant

              void applyObjectStyle (using: ObjectStyle[, clearingOverrides: bool=true][, clearingOverridesThroughRootObjectStyle: bool=false])
              Applies the specified object style.

              ParameterTypeDescription
              usingObjectStyleThe object style to apply.
              clearingOverridesboolIf true, clears the Button's existing attributes before applying the style. (Optional) (default: true) (Optional)
              clearingOverridesThroughRootObjectStyleboolIf true, clears attributes and formatting applied to the Button that are not defined in the object style. (Optional) (default: false) (Optional)

               

              -- so you can use one or even two trues; it's default is 'true'.