agentmail Posted October 10, 2013 Share Posted October 10, 2013 Hi All, I am a first time user of FusionPro, and would love some assistance if possible. Firstly, I need to point out I have no prior experience in Javascript, or any script for that matter! Word and Publisher used to be my best friends OK, so I am creating a variable document, and have come stuck on a couple of points. 1. I want to insert on the letter today's date, and have it automatically update based on the day I compose the file. On word, I just used insert date, but am assuming I need to create a rule for this? 2. I also need to create a future date, as the file I am working on has a prize and a closing date, based on the date the letter is sent. Again, I assume I need to create a rule that says 'add 14 days to today's date, for example' 3. The document will change from time to time, but the rules and resources will stay the same. Is there a way to export all resources, links etc. to then be able to use them in another document? Thanks so much for your assistance. If it matters, I am using Acrobat 9 and the latest FusionPro Quote Link to comment Share on other sites More sharing options...
step Posted October 10, 2013 Share Posted October 10, 2013 1. You want to create an empty text rule (name it something like: "TodaysDate") with the below code. The "lm d, yyyy" part formats the date to "October 10, 2013". To change that to a different format reference this for formatting strings. For example: "sm" = short month (i.e. Oct), "mm/dd/yy" (ie. 10/10/13) var today = new Date; return FormatDate(today,"lm d, yyyy"); 2. Create a second empty text rule (named something like "ClosingDate") containing the code below. The 14 will set the date 14 days into the future. Change that to reflect the number of days into the future you would like to return. var end = new Date; end = end.setDate(end.getDate() + 14); return FormatDate(end, "lm d, yyyy"); 3. For reusing your template and all of your rules, text frames, et cetera what I often like to do is to create a blank PDF with a graphic frame the size the document and move it to the back layer (FusionPro>Layers>Send Frame to Back) and pull in the pdf background as a variable graphic element. That way you can relink the background as the artwork (letter) changes come in without moving your FusionPro elements. Then apply this graphic rule to your graphic frame: var background = CreateResource("pdfName.pdf"); return background; Alternatively, you could import the background as a graphic resource by clicking the "Edit Resources" button and naming it something like "background". And then relink that resource to the new background for every change and not have to edit the graphic rule, which would be modified to the following: return Resource("background"); Hopefully this will get you started and familiar with the capabilities of FP. Welcome to the forum! Quote Link to comment Share on other sites More sharing options...
agentmail Posted October 10, 2013 Author Share Posted October 10, 2013 Thanks so much for that, that code worked perfectly! I will try to have a play with the final part. I worked out that I could use the resources and rules from another file, so was just a case of re-creating the Frames. Not ideal, but a work around until I find my way One final question (though I am sure there will be plenty more). With my data file, I have created and address block, but the original data is in lower case, and I need to make it upper case. I looked under the paragraph option, but could not find an option to do this. And because the data fields are just being inserted, I cannot adjust it in a rule. Is there some other way of doing this? Thanks once again, your help is really appreciated Quote Link to comment Share on other sites More sharing options...
step Posted October 11, 2013 Share Posted October 11, 2013 Unfortunately, there is not an option to change the casing from within the text editor. However, you could change casing for those fields from an OnRecordStart callback rule: // List the names of your fields you want to be all caps here var addBlock = [ "Full Name", "Company", "Delivery Address", "City" ]; for(var i=0; i<addBlock.length; i++){ FusionPro.Composition.AddVariable(addBlock[i], ToUpper(addBlock[i])); } Quote Link to comment Share on other sites More sharing options...
agentmail Posted October 13, 2013 Author Share Posted October 13, 2013 Thanks Step - unfortunately, I must be doing something wrong, as I am getting a message on validation saying Function Does Not Return a Value. When I save it, my variable address information is replaced with the field names I entered, but they are at least in upper case Any idea where I have done wrong? Quote Link to comment Share on other sites More sharing options...
esmith Posted October 14, 2013 Share Posted October 14, 2013 step accidentally left out a piece of the code (in red below): // List the names of your fields you want to be all caps here var addBlock = [ "Full Name", "Company", "Delivery Address", "City" ]; for(var i=0; i<addBlock.length; i++){ FusionPro.Composition.AddVariable(addBlock[i], ToUpper([color="Red"]Field([/color]addBlock[i][color="red"])[/color])); } Quote Link to comment Share on other sites More sharing options...
step Posted October 14, 2013 Share Posted October 14, 2013 Eric is correct, I made a slight oversight in my code. However, it shouldn't have validated incorrectly. Are you sure you pasted the code into the OnRecordStart Callback rule rather than just a blank text rule? Callback rules aren't expected to return anything. Quote Link to comment Share on other sites More sharing options...
agentmail Posted October 15, 2013 Author Share Posted October 15, 2013 Woohooo, that worked!!! You guys rule, have an awesome day! 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.