Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 8th, 2016, 02:06 PM
MikeCarenter MikeCarenter is offline
Junior Community Member
 
Join Date: Sep 2008
Posts: 10
Default script for output file name

i need help i use fusion pro to create a template for efi store front

We have jobs coming through the store front and all is fine with one exception The files are all named the same this is a business card order page so we have 50 files with the same name isnt working for me so I need a script like

new_file_name='BusinessCard_'+Field("Firstname")+' _'+Field("Lastname")+'.pdf'; FusionPro.Composition.outputFileName = new_file_name;
return 0;

but doesnt seem to work
Reply With Quote
  #2  
Old November 8th, 2016, 04:29 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,638
Default Re: script for output file name

Quote:
Originally Posted by MikeCarenter View Post
i need help i use fusion pro to create a template for efi store front

We have jobs coming through the store front and all is fine with one exception The files are all named the same this is a business card order page so we have 50 files with the same name isnt working for me so I need a script like

new_file_name='BusinessCard_'+Field("Firstname")+' _'+Field("Lastname")+'.pdf'; FusionPro.Composition.outputFileName = new_file_name;
return 0;

but doesnt seem to work
First, where are you putting this code? Setting FusionPro.Composition.outputFileName only works in the OnNewOutputFile callback rule, and only if you are chunking the output to multiple output files.

Also, does it work when you compose the job locally, in Acrobat? I'm pretty sure that web-to-print applications like DSF disallow renaming output files (and chunking). The reason they do this should be obvious: the web-to-print app needs to control the location of the output file, otherwise it won't know where it was generated and won't be able to locate it.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #3  
Old November 10th, 2016, 09:06 AM
MikeCarenter MikeCarenter is offline
Junior Community Member
 
Join Date: Sep 2008
Posts: 10
Default Re: script for output file name

then can you think of a way to have fusion pro name the pdf file using the first and last name??
Reply With Quote
  #4  
Old November 10th, 2016, 09:39 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,638
Default Re: script for output file name

Quote:
Originally Posted by MikeCarenter View Post
then can you think of a way to have fusion pro name the pdf file using the first and last name??
Yes, by checking the "Output to multiple files" box on the Output tab of the Composition Settings dialog, and setting FusionPro.Composition.outputFileName in the OnNewOutputFile callback rule.

I would be able to help you better if you could help me to help you by answering my questions. Again:
Quote:
Originally Posted by Dan Korn View Post
First, where are you putting this code?
And:
Quote:
Originally Posted by Dan Korn View Post
Also, does it work when you compose the job locally, in Acrobat?
Based on the answers to those questions, I might be able to suggest something more specific to help you.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old March 28th, 2017, 11:21 AM
-Lisa- -Lisa- is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Long Island, NY
Posts: 190
Default Re: script for output file name

Hi Dan,

I'm trying to do something similar here by placing the FusionPro.Composition.outputFileName into an OnNewOutputFile callback rule. When I validate the rule, I receive the error:
Quote:
Type error: FusionPro.Composition.outputFileName is not a function


This is what I'm placing inside the callback rule:
Code:
return FusionPro.Composition.outputFileName(Field("LastName") +'_'+Field("FirstName"));
I thought at first that something may be wrong with my syntax but that usually returns a syntax error...
__________________
Lisa B.
FusionPro VDP Creator 10.0.16
Adobe Acrobat Pro DC 2018
Mac OS X 10.13.6 (High Sierra)
Reply With Quote
  #6  
Old March 28th, 2017, 01:20 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 957
Default Re: script for output file name

Quote:
Originally Posted by -Lisa- View Post
This is what I'm placing inside the callback rule:
Code:
return FusionPro.Composition.outputFileName(Field("LastName") +'_'+Field("FirstName"));
I thought at first that something may be wrong with my syntax but that usually returns a syntax error...
There is something wrong with your syntax. It's that "FusionPro.Composition.outputFileName is not a function."

Try writing it like this:
Code:
FusionPro.Composition.outputFileName = Field("LastName") + '_' + Field("FirstName");
You'll probably also want to include an extension for the file name:
Code:
FusionPro.Composition.outputFileName = Field("LastName") + '_' + Field("FirstName") + '.' + FusionPro.Composition.outputFormatExtension;
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #7  
Old March 28th, 2017, 01:25 PM
-Lisa- -Lisa- is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Long Island, NY
Posts: 190
Default Re: script for output file name

You are the best, Ste!

Thank you again!!
__________________
Lisa B.
FusionPro VDP Creator 10.0.16
Adobe Acrobat Pro DC 2018
Mac OS X 10.13.6 (High Sierra)
Reply With Quote
  #8  
Old April 5th, 2022, 02:39 PM
ryanceot ryanceot is offline
Forum n00b
 
Join Date: Feb 2020
Posts: 9
Default Re: script for output file name

Is there a way to have Fusion Pro name the document with only the first letter of the first name? I've tried using

FusionPro.Composition.outputFileName = Field("KEY1") + substr(Field("PFNAME"),1,1) + Field("PCIFID") + Field("PDDATE") + ".pdf";

but get a substr is not defined error.
Reply With Quote
  #9  
Old April 6th, 2022, 09:44 AM
ThomasLewis's Avatar
ThomasLewis ThomasLewis is offline
Senior Contributor
 
Join Date: Feb 2011
Posts: 227
Default Re: script for output file name

You just have the syntax messed up. Try
Field("PFNAME").substr(0,1)

Or better yet, use
Field("PFNAME").charAt(0)
Reply With Quote
  #10  
Old April 7th, 2022, 10:53 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,638
Default Re: script for output file name

Quote:
Originally Posted by ThomasLewis View Post
You just have the syntax messed up. Try
Field("PFNAME").substr(0,1)

Or better yet, use
Field("PFNAME").charAt(0)
Or:
Code:
Left(Field("PFNAME"), 1)
Or just:
Code:
Field("PFNAME")[0]
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:02 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.