Copy link to clipboard
Copied
Using FM10 in TCS3 on Windows XP
Just finished watching Rick Quatro's webinar on ExtendScript. One of the sample scripts changes the alignment of anchored frames to left, center, or right. Is there any way to more precisely align the anchored frames using inches or pixels or whtaever?
As always, thanks in advance.
Copy link to clipboard
Copied
Everything that can be done to align an anchored frame using Frame's user interface can also be done via ExtendScript.
Open the ExtendScript ToolKit and take a look at the AFrame class in the Object Model Viewer. You will see the Properties and Methods that are available. It's getting late here but I may be able to write a small example script tomorrow.
Ian
Copy link to clipboard
Copied
Thanks so much, Ian.
Copy link to clipboard
Copied
Setting the positioning of an anchored frame is one of the easier procedures with ExtendScript, but there are limitations...
Assign the anchored frame to a variable named anchoredFrame, I won't go into the method of selection here.
To select the Anchoring Position use the following:
anchoredFrame.AnchorType = Constants.FV_ANCHOR_INLINE;
The other possible anchoring poitions are:
Constants.FV_ANCHOR_TOP
Constants.FV_ANCHOR_BELOW
Constants.FV_ANCHOR_BOTTOM
Constants.FV_ANCHOR_SUBCOL_LEFT
Constants.FV_ANCHOR_SUBCOL_RIGHT
Constants.FV_ANCHOR_SUBCOL_NEAREST
Constants.FV_ANCHOR_SUBCOL_FARTHEST
Constants.FV_ANCHOR_SUBCOL_INSIDE
Constants.FV_ANCHOR_SUBCOL_OUTSIDE
Constants.FV_ANCHOR_TEXTFRAME_LEFT
Constants.FV_ANCHOR_TEXTFRAME_RIGHT
Constants.FV_ANCHOR_TEXTFRAME_NEAREST
Constants.FV_ANCHOR_TEXTFRAME_FARTHEST
Constants.FV_ANCHOR_TEXTFRAME_INSIDE
Constants.FV_ANCHOR_TEXTFRAME_OUTSIDE
Constants.FV_ANCHOR_RUN_INTO_PARAGRAPH
Now that the anchoring position has been set, you can adjust the relevant positions just as you would with the user interface. The relevant properties are:
anchoredFrame.BaselineOffset
anchoredFrame.SideOffset
These two properties look useful, but they seem to be read only for anchored frames:
anchoredFrame.LocX
anchoredFrame.LocY
So, if you want to have more control over the horizontal positioning with the anchoring position set to Below Current Line (Constants.FV_ANCHOR_BELOW) you are probably out of luck - it can't be done using the user interface. In this case the best way would perhaps be to adjust the Anchored frame to match the column width then shift its entire contents to the required position. Perhaps someone knows a better way?
Ian
Copy link to clipboard
Copied
Wow, Ian, that was fast. I’ll give it a try.