eps ai para png adobe illustrator script js, como fazê-lo olhar em subpastas?

0

Eu encontrei este script on-line que permite que você converta em lote .ai ou .eps para png, mas ele só funciona em uma pasta de cada vez, alguém poderia me ajudar / me dizer o que ajustar para fazer funcionar em subpastas? alguém mencionou usando o comando resurse?

fonte: link

/**********************************************************

ADOBE SYSTEMS INCORPORATED Copyright 2005 Adobe Systems Incorporated All Rights Reserved

NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it.
If you have received this file from a source other than Adobe, then your use, modification, or distribution of it requires the prior written permission of Adobe.

*********************************************************/

/**********************************************************

Save as PDFs.js

DESCRIPTION

This sample gets files specified by the user from the selected folder and batch processes them and saves them as PDFs in the user desired destination with the same file name.

**********************************************************/

// Main Code [Execution of script begins here]

// uncomment to suppress Illustrator warning dialogs // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;

// Select the source folder. sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to PNG', '~' );

// If a valid folder is selected if ( sourceFolder != null ) { files = new Array(); fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );

// Get all files matching the pattern
files = sourceFolder.getFiles( fileType );

if ( files.length > 0 )
{
    // Get the destination to save the files
    destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PNG files.', '~' );
    for ( i = 0; i < files.length; i++ )
    {
        sourceDoc = app.open(files[i]); // returns the document object

        // Call function getNewName to get the name and file to save the pdf
        targetFile = getNewName();

        // Call function getPNGOptions get the PNGExportOptions for the files
        pngExportOpts = getPNGOptions();

        // Export as PNG
        sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );

        sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
    }
    alert( 'Files are saved as PNG in ' + destFolder );
}
else
{
    alert( 'No matching files found' );
}

}

/ ********************************************** ***********

getNewName: Função para obter o novo nome do arquivo. O primário name é o mesmo que o arquivo de origem.

*********************************************** *********** /

função getNewName () {     var ext, docName, newName, saveInFile, docName;     docName = sourceDoc.name;     ext = '.png'; // nova extensão para o arquivo png     newName="";

for ( var i = 0 ; docName[i] != "." ; i++ )
{
    newName += docName[i];
}
newName += ext; // full png name of the file

// Create a file object to save the png
saveInFile = new File( destFolder + '/' + newName );


return saveInFile;

}

/ ********************************************** ***********

getPNGOptions: Função para definir as opções de salvamento do PNG do arquivos usando o objeto PDFSaveOptions.

*********************************************** *********** /

função getPNGOptions () {

// Create the PDFSaveOptions object to set the PDF options var pngExportOpts = new ExportOptionsPNG24(); // Setting PNGExportOptions properties. Please see the JavaScript Reference // for a description of these properties. // Add more properties here if you like pngExportOpts.antiAliasing = true; pngExportOpts.artBoardClipping = true; pngExportOpts.horizontalScale = 250.0; //pngExportOpts.matte = true; //pngExportOpts.matteColor = 0, 0, 0; pngExportOpts.saveAsHTML = false; pngExportOpts.transparency = false; pngExportOpts.verticalScale = 250.0; return pngExportOpts;

}

    
por user2827759 17.10.2013 / 07:40

0 respostas