> So is it possible for a global java
> function to access and change the text
> in another text box, other that the
> one it is called from?
The short answer is No. You can't access individual frames or their
properties in a JavaScript rule in the current version of FusionPro.
Most rules are only evaluated once per record, not on a per-frame or
flow basis, so there's no context of a "current frame" whose properties
you could access. Neither is there any way to iterate through the
frames or flows in the template in JavaScript.
(Although, if you're using FusionPro Server to do batch compositions,
you can use the DIF Manipulation API to modify the just about any aspect
of the layout [DIF file] prior to composition, including adding or
removing entire frames/flows and pages, or even building up the layout
completely from scratch, but you can't do this within the composition
itself, in the current versions of FusionPro Server or Desktop.)
That said, however, Callback rules work a little bit differently than
other rules. Specifically, the OnCopyfit rule is called once for each
text flow whose contents are being copyfitted, and you can indeed use
different copyfit logic in different flows, by switching on the flow
name, as described in the "I want different copyfitting values for
different frames" section of the Rules Guide. (The name, like the text
contents, is actually a property of the flow, that is, the entire set of
connected text frames, rather than a property of the frame like
position, border, or fill color, although most flows have only one
frame.)
What is all of this leading up to? Well, I'm going to let you in on a
little secret. What you probably don't know about the OnCopyfit rule is
that, even though it's designed to do copyfitting by applying <magnify>
tags to the existing contents of the flow, you can actually use it to
completely replace the text in the flow. And you can switch on the flow
name to insert different text into different flows. You still can't
modify any of the frame properties like position, border, or fill, but
you can modify or replace the text contents.
This isn't really an advertised feature; it's more of an undocumented
trick, and it can get a bit messy. (See the HUGE CAVEAT below.) And it
won't help with graphic frames. But it can be a powerful weapon in your
arsenal.
What you want to do is first turn on Copyfit in your flow, and give your
flow a name. Then you want to modify the OnCopyfit rule to do something
like this (inserted at the beginning of the rule, before the existing
syntax):
if (FusionPro.Composition.CurrentFlow.name == "Title")
{
FusionPro.Composition.CurrentFlow.content =
'<para style="(no style)">'
+ '<f name="Arial"><z newsize="8.0">'
+ "This is my new content for frame "
+ FusionPro.Composition.CurrentFlow.name
+ '</para>';
return;
}
Obviously, you want to change the name you're comparing in the first
line to the name of the flow whose contents to want to modify.
The tricky thing here is that you're replacing the entire contents of
the flow, which is all of the tagged markup, including pairs of <para>
and </para> tags, defined in the layout/format (DIF file). This is
different than the unpaired <p> tags that you would use in a tagged
markup resource or input file, although the attributes are basically the
same. Your best bet is to export your format (DIF) file and copy the
tags from a flow's contents from there to start out with.
But, in between those <para> and </para> tags, you can put any tagged
markup you want into the paragraph. You can include multiple paragraphs
as well. You can also append or prepend to the existing text, or modify
it, instead of simply replacing it. Also, you don't have to just
replace or modify the contents and return; you can still call the
Copyfit function to actually copyfit your new contents if you want. You
probably want to leave the original Copyfit code in the rule anyway,
after the new code, so that other flows will continue to copyfit
normally.
HUGE CAVEAT: There are a lot of pitfalls here. Replacing the contents
of the entire flow like this is not documented, and not supported, and
may break in future versions without warning. If you get the markup
wrong, you can confuse FusionPro so badly that your job won't compose at
all, and it could even crash. Side effects may include nausea,
headaches, and in rare cases, a sudden loss of all coherent thought.
Ask your doctor if you're healthy enough to engage in extreme hacking
before starting. But if you get the tagging right, you can get some
cool results.
Here's another similar trick: You can use the (undocumented)
FusionPro.Composition.CurrentFlow.leadAvailable property to fill in
extra space in the frame/flow (either after or instead of calling the
Copyfit function). One neat thing you can do is to insert what's
sometimes called a "slug" graphic, of an appropriate size, to take up
the remaining space in the flow, kind of like the ads at the bottoms of
the columns in a phone book, using a <graphic> tag to place the graphic
inline. One way to do this would be to have a series of graphics of
various sizes, and to select one based on the remaining space. Another
way is to use the "height" attribute of the <graphic> tag to fill in the
available space. You'll have to play around with it to get decent
results. And the same HUGE CAVEAT applies here; in other words, if it
makes your computer blow up, don't blame me. With that in mind, have
fun!
Dan
P.S. It's JavaScript. Java is a completely different language.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!
Variable text on a curve and soft drop-shadows for variable text
LIMITED TIME upgrade offer of $299 per license for current customers:
http://fusionpro.printable.com/store/upgrade
New licenses available for $599 each at:
http://fusionpro.printable.com/store/
All FusionPro 5.0 customers to receive FusionPro 5.1 with
Adobe Acrobat 8 and InDesign CS3 support when released for FREE.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
--
Users of FusionPro Desktop have unlimited free email support. Contact Printable
Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm
--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--
--
Note: All e-mail sent to or from this address will be received or otherwise
recorded by the e-mail recipients of this forum. It is subject to archival,
monitoring or review by, and/or disclosure to someone other than the recipient.
Our privacy policy is posted on www.printplanet.com
--