file cleanup

Post Reply
danb
Newbie
Posts: 12
Joined: Tue May 10, 2016 1:01 am

file cleanup

Post by danb »

i have a flow that runs script in save as : script file property of illustrator flow element.

incoming PDF opens in illustrator
saves out ai file in desired location
closes file that had been opened

but incoming PDF that triggers the open and save as script just sits there.

how do i pass the PDF through to data out folder? thanks

////////////////////////////////

exportFileToAI ("/Volumes/CNC/");

function exportFileToAI (dest)
{
var saveOptions = new IllustratorSaveOptions();
var ai8Doc = new File(dest);
saveOptions.compatibility = Compatibility.ILLUSTRATOR15;
saveOptions.compressed = false;
app.activeDocument.saveAs( ai8Doc, saveOptions );
}
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: file cleanup

Post by freddyp »

There are a couple of rules to be followed, and then all will be well:
https://www.enfocus.com/manuals/UserGui ... tions.html
danb
Newbie
Posts: 12
Joined: Tue May 10, 2016 1:01 am

Re: file cleanup

Post by danb »

not understanding the rules. and how they are applied.
can you elaborate?
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: file cleanup

Post by freddyp »

You must use $doc instead of app.activeDocument. You must write the output in $outfolder and you must add the output file path to the array $outfiles. Without testing:

Code: Select all

var saveOptions = new IllustratorSaveOptions();
saveOptions.compatibility = Compatibility.ILLUSTRATOR15; 
saveOptions.compressed = false;
var ai8DocPath = $outfiles + "/" + $filename + ".ai";
var ai8Doc = new File( ai8DocPath);
$doc.saveAs( ai8Doc, saveOptions );
$outfiles = [ai8DocPath];
Post Reply