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 Object Style to specific text frame with label name

Return to Member Forum

  • Author
    Posts
    • #91579
      Kathy Cote
      Member

      Hi,
      I need your help. I have several text frames with different labels and I would like to apply them a different object style.
      How can I automatically select all text boxes that have the “Top” label and applied to them an object style?
      I do not want to select them one by one.

      ////This are my Text frame with label
      myFrame1.label = “Top”;
      myFrame2.label = “Bottom”;

      var myObjectStyle1 = “CIS_Slug_Top”;
      var myObjectStyle2 = “CIS_Slug_Bottom”;

      //I would like to applied object style to text frame with specific label. I don’t know how to access
      myFrame1.applyObjectStyle(myObjectStyle1);
      myFrame2.applyObjectStyle(myObjectStyle2);

      Thanks a lot for your help
      Kathy

    • #91602

      This isn’t possible since CS5 (?) anymore. Instead you must loop through all frames and check the label (or name).

      Kai

    • #91646
      Kathy Cote
      Member

      Hi,
      Ok I got it.

      Thanks ;-)

      ////////////////
      #target indesign
      var myDoc = app.documents[0];
      var myFrames = myDoc.textFrames;
      var myObjectStyle = “CIS_Slug_Top”; //Object Style qui doit déja etre par default dans Indesign

      for (var i=0; i< myFrames.length ; i++) {
      if (myFrames[i].label == “Label2”){
      myFrames[i].applyObjectStyle(myDoc.objectStyles.item(myObjectStyle));
      alert (“OK Done”); // you changes here
      }
      }

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads