Highlighted

FrameMaker script: alignment of all anchored frames in document to "Left"

New Here ,
Oct 06, 2016

Copy link to clipboard

Copied

I'm a long term FrameMaker (11) user, but completely new to scripting.

Can someone help me make a script that will set the alignment for all anchored frames in a document to "Left"?

Can someone help me make a script that will set the positioning for all anchored frames in a document to "Below current line"?

TOPICS
Scripting

Views

284

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

FrameMaker script: alignment of all anchored frames in document to "Left"

New Here ,
Oct 06, 2016

Copy link to clipboard

Copied

I'm a long term FrameMaker (11) user, but completely new to scripting.

Can someone help me make a script that will set the alignment for all anchored frames in a document to "Left"?

Can someone help me make a script that will set the positioning for all anchored frames in a document to "Below current line"?

TOPICS
Scripting

Views

285

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2016 0
Advocate ,
Oct 06, 2016

Copy link to clipboard

Copied

Hello Inemeth,

The first step is to get access to the currently active document. That is easy enough:

var oDoc = app.ActiveDoc;

This oDoc object contains linked lists of all kinds of elements in the document. The linked list of anchored frames is not a separate, as anchored frames are graphic objects. There is a list of graphic objects, starting with FirstGrapicInDoc. Each object has a pointer to the next one: NextGraphicInDoc. The trick is to figure out whether the current object is an anchored frame or not. This is done by looking at the name of its constructor.

var oGraphic = oDoc.FirstGraphicInDoc;

while( oGraphic.ObjectValid( ) )

{

     if( oGraphic.constructor.name == "AFrame" )

     {

          /* Do something with the anchored frame */

     }

     oGraphic = oGraphic.NextGraphicInDoc;

}

This is the basic code that will find all anchored frames in your document.

In the commented section you can change alignment and placement by setting these properties to the required valies:

     oGraphic.alignment = Constants.FV_ALIGN_LEFT;

     oGraphic.placement = Constants.FV_ANCHOR_BELOW;

I hope this helps your current problem, as well as get you on the right track with scripting.

Kind regards from Amsterdam

Jang

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2016 0