I am looking for an Applescript for Illustrator CS2 which saves Illustrator EPS-files into native AI-files… Who can help?
thnx
I am looking for an Applescript for Illustrator CS2 which saves Illustrator EPS-files into native AI-files… Who can help?
thnx
Set up for Illustrator CS (Drag and drop) so the creator code may need to be modified for CS2. This should create a new “.ai” and leave the original “.eps” file in place.
--=============================
--builds a list of all files, including those nested in the folders dropped
--=============================
on BuildList(DroppedItems)
set NewList to {}
repeat with AnItem in DroppedItems as list
set AnItem to AnItem as string
if the last character of AnItem is ":" then
tell application "Finder"
set FileList to (files of entire contents of alias AnItem whose creator type is "ART5")
end tell
repeat with AFile in FileList
set AFile to AFile as string
set NewList to NewList & AFile
end repeat
else
tell application "Finder"
if creator type of alias AnItem is "ART5" then set NewList to NewList & AnItem
end tell
end if
end repeat
return NewList
end BuildList
--=============================
set DroppedItems to choose folder
on open (DroppedItems)
--build the list of files to process
set FileList to BuildList(DroppedItems)
repeat with theFile in FileList
--Process The Files droppeed
tell application "Illustrator CS"
activate
open alias theFile --without dialogs
save document 1 in alias theFile as Illustrator with options {compatibility:Illustrator 11, compressed:false, font subset threshold:0.0, PDF compatible:true}
close document 1 saving no
end tell
end repeat
activate me
display dialog "Done"
end open
Something is not working…
When I run the script, it starts but at a certain point the script gives an error. It expects a file/folder… nothing happens.
What can this be?
regards,
Kris
I’m not sure, you dropped a folder to process on the script?
Try:
--=============================
--builds a list of all files, including those nested in the folders dropped
--=============================
on BuildList(DroppedItems)
set NewList to {}
repeat with AnItem in DroppedItems as list
set AnItem to AnItem as string
if the last character of AnItem is ":" then
tell application "Finder"
set FileList to (files of entire contents of alias AnItem whose creator type is "ART5")
end tell
repeat with AFile in FileList
set AFile to AFile as string
set NewList to NewList & AFile
end repeat
else
tell application "Finder"
if creator type of alias AnItem is "ART5" then set NewList to NewList & AnItem
end tell
end if
end repeat
return NewList
end BuildList
--=============================
set DroppedItems to choose folder
set FileList to BuildList(DroppedItems)
repeat with theFile in FileList
--Process The Files droppeed
tell application "Illustrator CS"
activate
open alias theFile --without dialogs
save document 1 in alias theFile as Illustrator with options {compatibility:Illustrator 11, compressed:false, font subset threshold:0.0, PDF compatible:true}
close document 1 saving no
end tell
end repeat
activate me
display dialog "Done"
I just took the on open handler out and replaced it with a choose folder command. double click on the script and direct it to the folder to process. This works on my computer with Illustrator CS.
Hi Jerome,
the script now works perfect but it only does the first file in the folder… Is this because the files are saved in the same folder?
regards,
Kris
It processes multiple files fine for me. My guess is that you are processing files that might have a different creator type. Since this script is pulling just those files with the ART5 creator type, if the file has a different one then it will not process those. ART5 is used for Illustrator CS and CS2. You might change this to:
set FileList to (files of entire contents of alias AnItem whose file type is "EPSF")
--and
if file type of alias AnItem is "EPSF" then set NewList to NewList & AnItem
which should pull all eps files, that is assuming that all the files that you need to process are eps files.
You could also try this:
set inputFolder to choose folder with prompt "Where are the Files."
tell application "Finder"
set filesListA to files in inputFolder
if (exists folder "As AI's" in inputFolder) then
set MyFolderA to folder "As AI's" of inputFolder
else
set MyFolderA to make new folder at inputFolder with properties ¬
{name:"As AI's"}
end if
end tell
repeat with aFile in filesListA
set fileIndex to 0
tell application "Finder"
set theFile to aFile as alias
end tell
tell application "Illustrator CS"
activate
open theFile with options {update legacy text:true} without dialogs
--You may want to set to {update legacy text:false}
set docRef to the current document
tell docRef
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
set newFileName to (MyFolderA as string) & docBaseName & ".ai"
end tell
save docRef in file newFileName as Illustrator with options ¬
{class:Illustrator save options, compatibility:Illustrator 11, compressed:true, embed ICC profile:false, embed linked files:false, flatten output:preserve appearance, font subset threshold:0.0, PDF compatible:true}
close docRef without saving
end tell
end repeat
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseName
other save options
save docRef in file newFileName as eps with options {class:EPS save options, preview:color Macintosh, overprint:discard, embed all fonts:true, embed linked files:false, include document thumbnails:true, compatible gradient printing:false, CMYK PostScript:true, PostScript:level 2}
save docRef in file newFileName as pdf with options ¬
{class:PDF save options, acrobat layers:false, changes allowed:pdf 128 any changes, color compression:automatic JPEG high, color downsampling:300, color downsampling threshold:450, color resample:bicubic downsample, compatibility:Acrobat 5, compress art:true, embed ICC profile:false, enable access:true, enable copy:true, enable copy and access:true, font subset threshold:0.0, generate thumbnails:true, grayscale compression:automatic JPEG high, grayscale downsampling:300, grayscale downsampling threshold:300, grayscale resample:bicubic downsample, monochrome compression:CCIT4, monochrome downsampling:300, monochrome downsampling threshold:450, monochrome resample:bicubic downsample, optimization:true, preserve editability:true, printer resolution:1200, registration marks:false, view pdf:false}
Thanks Jerome! You helped me a lot…