2 Replies Latest reply on Oct 30, 2017 12:34 AM by KeKeJ

    How to colorize AFrames

    KeKeJ Level 1

      Hi,

       

      I am trying the automatic processing below.

      • Add borders to Aframes
      • Colorize Aframes

       

      Before:

      before.jpeg

      After:

      after.jpeg

       

      Adding borders succeeded, but I can't add colors to AFrames.

      My script is below.

       

       

      var doc = app.ActiveDoc;
      if (doc.ObjectValid() == true) {
        var colorFormat = doc.GetNamedObject(Constants.FO_Color, "Red");
        var colorProps = colorFormat.GetProps(); 
        
        var flow = doc.MainFlowInDoc;
        var textFrame = flow.FirstTextFrameInFlow;
        while (textFrame.ObjectValid()) {
          var aFrame = textFrame.FirstAFrame;
          while (aFrame.ObjectValid()) {
            aFrame.Pen = 0;  //=> works!
            
            aFrame.Color.SetProps(colorProps); //=> doesn't work...
            aFrame.SetProps(colorProps); //=> doesn't work...
            aFrame.Color.Name = "Red";  //=> doesn't work...
      
      
            aFrame = aFrame.NextAFrame;
          }
          textFrame = textFrame.NextTextFrameInFlow;
        }
      }
      

       

      Please teach me how to handle it.

       

      Thanks,

       

      Koji Koike