Jump to content

Obtain Current Text Frame Name


Chilton

Recommended Posts

I am creating a saddle-stitched document with two text frames on a single spread, repeated over four pages (8 text frames). As a way to insert specific page breaks, and to drive default content when the text flow stops and there are empty frames, I need to determine the current text frame name so I can name the next sequential one and drive the content there.

 

Simply linking the frames in a specific order has proven too simple and the data flow is too varied to make this a viable option.

 

I am trying to use the following code to get the current Text Frame Name:

var currentFrame = FindTextFrame(FusionPro.Composition.CurrentFlow.name);
return currentFrame;

Unfortunately, when validating, I get the following error:

/Library/Application Support/PTI/FusionPro/Buoltins.js, line 3113: Error: In FindFrame(), no frame name specified

How am I supposed to retrieve the current frame name with this function? I have combed the Forums, and found no specific example of grabbing the current text frame name and using it in a rule to drive content.

 

Thanks, in advance, for any help!

Link to comment
Share on other sites

As the name denotes, the FusionPro.Composition object and its properties are valid only at composition time, not at rule validation time. There is no context of a "current text frame" when you're just validating the rule in the Rule Editor, so I'm not sure what you would expect to happen.

 

So, even though you get an error when you validate the rule in the editor, it should work when you compose or preview, as long as you have the "Re-evaluate this rule for every text flow" box checked.

 

What you might want to do is put the code into a conditional block based on the FusionPro.inValidation property, like so:

if (!FusionPro.inValidation)
{
   var currentFrame = FindTextFrame(FusionPro.Composition.CurrentFlow.name);
   return currentFrame;
}
//else
return "Frame name not available at rule validation time.";

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...