Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Apply ObjectStyles to Text Frames

Return to Member Forum

  • Author
    Posts
    • #90520
      Kathy Cote
      Member

      Hi
      I need help with my code. I created a new text box and I would like to apply an object style to this text box. Note that object style and paragraph styles are already default in Indesign.

      I did several tests but it does not work

      ————
      Code:

      //New Text Frame
      myFrame=newDoc.textFrames.add(newDoc.layers.item(“Slug”));
      myFrame.contents = K + ” ” + G + (“\r”) + H ;
      myFrame.geometricBounds = [-5,0,0,D]; ////Top, Left, Bottom, Right
      //OK for now

      //To apply Object Style,
      //I have tried this:
      //var myObjectStyle = “Slug”;
      //myFrame.applyObjectStyle(newDoc.objectStyles.item(myObjectStyle));

      //I have tried this:
      //myFrame.applyObjectStyle(myObjectStyle, true);

      //and many more

      ————

      Or is it possible to apply an Object Style according to the label name?
      myFrame.label = “SlugTx”;

      ————

      I have a pdf with examples of scripts but this seems to be only for Indesign CS6 and I’m working with 2015. So I’m not sure about which object model I should use.

      If you have the solution ca would be greatly appreciated

      Thanks
      Kathy

    • #90521
      Anonymous
      Inactive

      Try this:

      myFrame=newDoc.textFrames.add(
      {
      itemLayer:newDoc.layers.item(“Slug”),
      contents:K + ” ” + G + (“\r”) + H ,
      geometricBounds : [-5,0,0,D],
      appliedObjectStyle:myObjectStyle,
      label: “SlugTx”;
      }
      );

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads