Skip to main content
Participant
October 30, 2017
Answered

How to colorize AFrames

  • October 30, 2017
  • 1 reply
  • 533 views

Hi,

I am trying the automatic processing below.

  • Add borders to Aframes
  • Colorize Aframes

Before:

After:

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

This topic has been closed for replies.
Correct answer Klaus Göbel

Hi Koji,

just try this:

aFrame.Color = colorFormat;

a.Frame.Color is a colorobject. So you have to assign a colorobject also.

1 reply

Klaus Göbel
Klaus GöbelCorrect answer
Legend
October 30, 2017

Hi Koji,

just try this:

aFrame.Color = colorFormat;

a.Frame.Color is a colorobject. So you have to assign a colorobject also.

KeKeJAuthor
Participant
October 30, 2017

Hi Klaus,

Thank you very much for your quick answer.

I will reread references to understand objects in FrameMaker more.

Best regards,