Necesito bajar unos cientos de archivos AI de AI CC a CS6. Están dispersos en docenas de carpetas y necesito una forma de sobrescribir recursivamente los archivos AI CC con archivos compatibles con CS6.
Investigué y probé algunas soluciones, pero ninguna de ellas cumple con los requisitos.
Óptimamente, esto debería ser un script .jsx reutilizable, pero si hay otra forma de hacerlo de alguna manera a través del Finder de OS X (savedSearch), también sería bueno.
Gracias de antemano por su ayuda.
PD : Encontré dos scripts que más o menos hacen lo que necesito. Intenté hacer un Frankenscript con partes de ambos, pero aún no tuve éxito.
Como no era complicado, decidí escribirlo desde cero. No esperaría que el script fuera muy rápido, debido al hecho de que está abriendo, guardando y cerrando archivos. Debería depender en gran medida de su computadora y de los archivos .ai en cuestión.
Asegúrese de verificar las dos primeras variables: overwrite
y targetVersion
, antes de intentar ejecutar el script. También es posible que desee verificar la SaveOptions_ai
función para ajustar aún más la configuración de guardado
Como siempre, use bajo su propio riesgo. Especialmente con la opción de sobrescritura activada, este es un script extremadamente destructivo y puede inutilizar sus archivos, si lo guarda con una versión de archivo lo suficientemente baja. Si desea sobrescribir, le sugiero que duplique la carpeta principal antes de ejecutar el script.
// Illustrator convert to legacy.jsx
// https://gist.github.com/joonaspaakko/df2f9e31bdb365a6e5df
// Finds all .ai files from the input folder + its subfolders and converts them to the version given below in a variable called "targetVersion"
// Tested in Illustrator cc 2014 (Mac)
// Didn't bother to do a speed test with my macbook air...
#target illustrator
// If set to false, a new file will be written next to the original file.
// The new file will have (legacyFile) in the name.
// Files with (legacyFile) in the file name are always ignored.
var overwrite = true, // boolean
// Accepted values:
// 8, 9, 10, 11 (cs), 12 (cs2), 13 (cs3), 14 (cs4), 15 (cs5), 16 (cs6), 17 (cc)
targetVersion = 13;
if ( app.documents.length > 0 ) {
alert("ERROR: \n Close all documents before running this script." );
}
// Run the script
else {
var files,
folder = Folder.selectDialog("Input folder...");
// If folder variable return null, user most likely canceled the dialog or
// the input folder and it subfolders don't contain any .ai files.
if ( folder != null ) {
// returns an array of file paths in the selected folder.
files = GetFiles( folder );
// This is where things actually start happening...
process( files );
}
}
function process( files ) {
// Loop through the list of .ai files:
// Open > Save > Close > LOOP
for ( i = 0; i < files.length; i++ ) {
// Current file
var file = files[i]
// Open
app.open( file );
// If overwrite is false, create a new file, otherwise use "file" variable;
file = !overwrite ? new File( file.toString().replace(".ai", " (legacyFile).ai") ) : file;
// Save
app.activeDocument.saveAs( file, SaveOptions_ai() )
// Close
app.activeDocument.close( SaveOptions.DONOTSAVECHANGES );
}
// For better of for worse...
alert( "Script is done." );
}
function SaveOptions_ai() {
var saveOptions = new IllustratorSaveOptions();
saveOptions.compatibility = Compatibility[ "ILLUSTRATOR" + targetVersion ];
saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
saveOptions.compressed = true; // Version 10 or later
saveOptions.pdfCompatible = true; // Version 10 or later
saveOptions.embedICCProfile = true; // Version 9 or later
saveOptions.embedLinkedFiles = false; // Version 7 or later
return saveOptions
}
function GetFiles( folder ) {
var i, item,
// Array to store the files in...
files = [],
// Get files...
items = folder.getFiles();
// Loop through all files in the given folder
for ( i = 0; i < items.length; i++ ) {
item = items[i];
// Find .ai files
var fileformat = item.name.match(/\.ai$/i),
legacyFile = item.name.indexOf("(legacyFile)") > 0;
// If item is a folder, check the folder for files.
if ( item instanceof Folder ) {
// Combine existing array with files found in the folder
files = files.concat( GetFiles( item ) );
}
// If the item is a file, push it to the array.
else if ( item instanceof File && fileformat && !legacyFile ) {
// Push files to the array
files.push( item );
}
}
return files;
}
files = files.concat( GetFiles( item ) );
combina la matriz existente con los archivos que se encuentran en la carpeta. Pero, ¿qué sucede si la subcarpeta contiene archivos con el mismo nombre que en la carpeta?concat
funciona y el otro es cómo funciona la IA. Por lo tanto, concat
no se preocupe por los duplicados en primer lugar. Simplemente pega la segunda matriz al final de la primera matriz sin hacer preguntas. Pero, afortunadamente, dado que se trata de matrices con rutas completas a los archivos que luego se alimentan a AI, se tratan como cualquier otro archivo.Así que acabo de descubrir el concepto de scripts de Illustrator hoy y no tengo idea de cómo crear o editar uno. Probé este y funcionó para mí para convertir archivos ai más nuevos en archivos ai heredados, pero me pregunto si hay una versión que le permita tomar un archivo eps más nuevo y guardarlo en un archivo ai más antiguo (cs6). ?
Joonas
marco