Jump to content

Can I get variable data to overwrite a line?


Recommended Posts

Sure, you can do something like this, if you name the text frame:

var content = Field("Name");
var font = "Arial Unicode MS";
var pointSize = 18;
var frameName = "Title";
var line = "___________________";
return CopyfitLine(content, line, font, pointSize, FindTextFrame(frameName).GetSettableTextWidth() / 100.0, 2, true);

Link to comment
Share on other sites

Please forgive me, I'm new to this. How do I 'name the text frame', and where would I do that?

 

I wrote:

var content = Field("D.O.B.");

var font = "ITCAvant Garde Std XLt Cn";

var pointSize = 8;

var frameName = "RecipientDOB";

var line = "________________";

return Copyfitline(content, line, font, poinSize, FindTextFram(frameName) .GetSettableTextWidth() / 100.0, 2, true;

 

It comes back with an error 'FrameName is not defined.'

Link to comment
Share on other sites

Please forgive me, I'm new to this. How do I 'name the text frame', and where would I do that?

On the Text Frame Properties palette, at the top, above the "Edit Text" button.

I wrote:

var content = Field("D.O.B.");

var font = "ITCAvant Garde Std XLt Cn";

var pointSize = 8;

var frameName = "RecipientDOB";

var line = "________________";

return Copyfitline(content, line, font, poinSize, FindTextFram(frameName) .GetSettableTextWidth() / 100.0, 2, true;

 

It comes back with an error 'FrameName is not defined.'

Is that the code copied verbatim from your Rule Editor dialog? You seem to have missed some characters. On the last line, "FindTextFram" should be "FindTextFrame" (with the "e" at the end, and without quotes). Also, make sure you use the same case in your variable names throughout: if you declare a variable "frameName", you have to refer to it with the exact same name, and the same case, not as "FrameName".

Link to comment
Share on other sites

Ok. Success. Fixed the Frame name and get the appropriate data. However, I still am left with my original issue. I need the end of the line to be in the same place, no matter what the variable text is. IE

Recipient D.O.B: __________________.

Recipient Maiden Name: ____________.

 

Is there a way to do that? Maybe a calculation of some sort?

Link to comment
Share on other sites

Ok. Success. Fixed the Frame name and get the appropriate data. However, I still am left with my original issue. I need the end of the line to be in the same place, no matter what the variable text is. IE

Recipient D.O.B: __________________.

Recipient Maiden Name: ____________.

 

Is there a way to do that? Maybe a calculation of some sort?

That's what the rule is supposed to do. It works for me in a little sample job. If it's not working for you, you should collect up a sample which shows the problem and post it here.

Link to comment
Share on other sites

ok, here is an output file. First pages, second line The end is moving with the variable text.

 

This is what I have written:

var content = Field("D.O.B.");

var font = "ITC Avant Garde Std ELt Cn";

var pointSize = 8;

var frameName = "Rec DOB";

var line = ": ___________________________________";

 

return CopyfitLine(content, line, font, pointSize, FindTextFrame(frameName) .getsettableTextWidth() / 100.0, 2, true);

 

Thank you for your assistance.:)

Voucher-Output.pdf

Link to comment
Share on other sites

ok, here is an output file. First pages, second line The end is moving with the variable text.

 

This is what I have written:

var content = Field("D.O.B.");

var font = "ITC Avant Garde Std ELt Cn";

var pointSize = 8;

var frameName = "Rec DOB";

var line = ": ___________________________________";

 

return CopyfitLine(content, line, font, pointSize, FindTextFrame(frameName) .getsettableTextWidth() / 100.0, 2, true);

 

Thank you for your assistance.:)

I was hoping you would do what I asked, and collect up a sample job to post, instead of just the output, but I think I can figure out what's wrong. You probably just need to start with a longer line, so that it can be shrunk down, something like this:

var line = ":  ______________________________________________________________________";

You may need to play around with it to get something that works for the particular frame in question.

Link to comment
Share on other sites

Sorry, I mis-understood. Here is the zip file. I tried making the line longer with no success. Thank you for helping me.

Okay, thanks.

 

There are a couple of problems here. First, you still don't have a long enough line of underscores to start with, as your frame is very long for the 8-point text you're starting out in.

 

Second, you can't put anything else on the line. In the Text Editor, you have this:

Recipient «Testing_Rule»

But the rule is trying to fit what it's returning into the full width of the frame, not the width that's left over after the word "Recipient." So you need to put the word "Recipient" in the rule, instead of in the text frame.

 

It all works for me if I change the frame to just have this:

«Testing_Rule»

And the rule to this:

var content = "Recipient " + Field("D.O.B.");
var font = "ITC Avant Garde Std XLt Cn";
var pointSize = 8;
var frameName = "Rec DOB";
var line = ": " + Array(100).join('_');
return CopyfitLine(content, line, font, pointSize, FindTextFrame(frameName).GetSettableTextWidth() / 100.0, 2, true); 

Note that I used a little trick with Array.join to build up a string of underscores, which makes the rule syntax a bit more manageable than hard-coding all those literal underscores.

 

Also, you misspelled "pedigree" in the sample data.

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...