Hello,
I need to export in PDF many AI files which are in many folders. I’m trying to write a script that allow me find required AI files, open these in Adobe Illustrator, and save as PDF with use specific preset.
So this is what I have:
set sourceFolder to choose folder with prompt "Source folder"
tell application "Finder" to set fileList to (every file of entire contents of folder sourceFolder whose name contains "box" and name extension is "ai") as alias list
set destFolder to sourceFolder
on SavePDF(fileList, destFolder)
set destPath to destFolder as Unicode text
repeat with aFile in fileList
tell application "Finder" to set fileName to name of aFile
set newFilePath to destPath & fileName
tell application "Adobe Illustrator"
open aFile
save current document in file newFilePath as pdf with options {class:PDF save options, PDF preset:"my_preset"}
close current document saving no
end tell
end repeat
end SaveFilesAsPDF
SavePDF(fileList, destFolder)
All of that work nice, besides saving PDFs in right places.
AI files are in many subfolders and I have no idea how should look this line: “set destFolder to sourceFolder” to make individual PDFs will be save in the same folders where are original AI files.
I hope that someone can help me solve this problem.
Thanks in advance and Regards