RCardinale Posted July 5, 2013 Share Posted July 5, 2013 I created a line that reads: Recipient "variable data" ________________________________________. How can I make the beginning of the line adjust to whatever size the variable data is? Is this possible? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 5, 2013 Share Posted July 5, 2013 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); Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 5, 2013 Author Share Posted July 5, 2013 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.' Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 5, 2013 Share Posted July 5, 2013 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". Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 5, 2013 Author Share Posted July 5, 2013 Ha. I typed to fast for my own good. The e was there, but I had a Cap F for frameName. Now I get error 'line 3113:Error:In FindFrame(), no frame named"RecipientDOB" Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 6, 2013 Share Posted July 6, 2013 Now I get error 'line 3113:Error:In FindFrame(), no frame named"RecipientDOB" Is that the exact name of your text frame? Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 8, 2013 Author Share Posted July 8, 2013 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? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 8, 2013 Share Posted July 8, 2013 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. Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 8, 2013 Author Share Posted July 8, 2013 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 Quote Link to comment Share on other sites More sharing options...
dreimer Posted July 9, 2013 Share Posted July 9, 2013 Quick glance at your output. Is the second Recipient line always the same text frame "Rec DOB"? Looks like you have different variables being populated there. Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 9, 2013 Author Share Posted July 9, 2013 Yes. The frame is Rec DOB. The different entries are just coming from the csv. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 9, 2013 Share Posted July 9, 2013 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. Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 9, 2013 Author Share Posted July 9, 2013 Sorry, I mis-understood. Here is the zip file. I tried making the line longer with no success. Thank you for helping me.Flu - Pharmacy Voucher-2.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 9, 2013 Share Posted July 9, 2013 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. Quote Link to comment Share on other sites More sharing options...
RCardinale Posted July 9, 2013 Author Share Posted July 9, 2013 That worked. Thank you for all of your help. I really like this array variable. I will use it a lot in the future. Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.