Page 1 of 1

file cleanup

Posted: Tue Jun 04, 2019 10:47 pm
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 );
}

Re: file cleanup

Posted: Wed Jun 05, 2019 2:04 pm
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

Re: file cleanup

Posted: Thu Jun 06, 2019 1:55 am
by danb
not understanding the rules. and how they are applied.
can you elaborate?

Re: file cleanup

Posted: Thu Jun 06, 2019 9:45 am
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];