billn Posted December 3, 2013 Share Posted December 3, 2013 I've got too much space between a variable and a period after it. Is there a way to adjust it without affecting the tracking on the rest of the line? Quote Link to comment Share on other sites More sharing options...
billn Posted December 3, 2013 Author Share Posted December 3, 2013 I want to reduce the space between a variable and a period. Is there a way to do this? Quote Link to comment Share on other sites More sharing options...
step Posted December 4, 2013 Share Posted December 4, 2013 I haven't seen your template or a sample of the data you're trying to add tracking to, but it sounds like you basically want to add tracking tags around the last letter of a variable when it's followed by a period so that only the period will move closer to the last letter of the variable and leave the rest of the letters alone. I also made the assumption that you have a text frame that you are doing all of your text editing in and you're pulling your variables in by adding them from the drop down menu. If both of those assumptions are true, this solution may work for you: 1. Name the text frame that you want to adjust the tracking on. In my code I named it "content" but you can be as descriptive as you'd like. Just make sure the code matches what you named the frame. 2. Paste this code into an OnRecordStart Callback rule: var trackingSize = "-10"; // Tracking from -100% to 500% var fieldName = "NAME"; // Name of the field var frameName = "content"; //Name of the text frame var find = new RegExp('<variable name="'+ fieldName +'">' + "\\.","g"); var replace = Field(fieldName).replace(/(.)$/,'<tracking newsize="'+ trackingSize +'">$1</tracking>.'); FindTextFrame(frameName).content = FindTextFrame(frameName).content.replace(find,replace); Type the name of the variable that you are trying to add tracking to between the quotes. The code essentially scans the content of the text frame for the variable defined followed by a period. If it finds it, it adds tracking tags around the last letter of the variable. You can adjust the tracking amount, "-10" was just a guess. Hope that helps! Quote Link to comment Share on other sites More sharing options...
billn Posted December 4, 2013 Author Share Posted December 4, 2013 Your assumptions were right on the money. I added the rule and it composed perfectly. Thanks for helping out a java script beginner. 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.