Thanks freddyp on the quotes tips. has added escape character
i've also added PDFtk to the windows environment variables
Code: Select all
function jobArrived( s : Switch, job : Job )
{
//pdftk A=fronts.pdf B=back_x1500.pdf shuffle A B output print_job.pdf
var jobFolder = job.createPathWithName(job.getNameProper(), true);
var pdfFilename = jobFolder + "/" + job.getNameProper() + ".pdf";
var fronts = '\"C:\\SwitchTemplate\\PCFrontV01.pdf\"';
var backs = job.getPath();
var AA = "A="+fronts;
var BB = "B="+"\""+backs+"\"";
var CC = "\""+pdfFilename+"\"";
command = "pdftk"+" "+AA+" "+BB+" shuffle A B"+" output"+" "+CC;
var exitCode = Process.execute(command);
s.log(2, Process.stderr);
s.log(1, command);
s.log(1, exitCode);
}
When running the command at cmd prompt, it only works when output destination is changed to location outside of AppData eg: "c:\output3.pdf"Error: Unable to find file. Error: Failed to open PDF file: "C:\SwitchTemplate\PCFrontV01.pdf" Error: Unable to find file. Error: Failed to open PDF file: "C:/Users/ADMINI~1/AppData/Local/Temp/2/FixtureTest01/inFolder2/_00001_playingCardBack_v01-X56.pdf" Errors encountered. No output created. Done. Input errors, so no output created.
Thanks jan_suhrpdftk A="C:\SwitchTemplate\PCFrontV01.pdf" B="C:/Users/ADMINI~1/AppData/Local/Temp/2/FixtureTest01/inFolder2/_00001_playingCardBack_v01-X56.pdf" shuffle A B output "C:/Users/Administrator/AppData/Roaming/Enfocus/SwitchScripter/temp/1/ScriptElement/1/13/playingCardBack_v01-X56/playingCardBack_v01-X56.pdf"
Now i need to figure out how to execute the *.bat file
Btw, dkelly i reckon PDFtk doesn't like the "'," the array added in between and i has revert back to building the command string.