Advertisement


Photoshop batch job: export to folder (filenames)


Question

I'm trying to run a batch file on a custom action. The action does one thing: File -> Export -> Paths to Illustrator.

However, whenever I run that action as a batch on multiple files, it saves each file with the same name. So if I open File1.psd and save it as working/File1.ai, then run the batch on File2.psd, File3.psd, and File4.psd, what I get is working/File1.ai as an Illustrator file exported from File4.psd. Files 2 and 3 have been overwritten (as was File1.ai, obviously).

Here's my Batch dialog: Screen shot of Batch dialog box

If I change the destination to e.g. Folder, it re-saves all the files as PSD in addition to overwriting the AI files. How can I run this export on an arbitrary number of PSD files and get the same number of AI files out the other end?

EDIT: re-recording the action and refusing the dialog box gets me the dialog box on the first run of the batch, and subsequent files saved under the name I provide in that dialog (in other words, one dialog box for all files).

EDIT 2: Following the answer below, I tried saving to Folder and overriding action save commands (screen shot): second try batch process dialog

This produced the same results. :(

Here's the action I'm running: action definition screen shot

ETA 3: Based on the comments, my problem might be that the Export -> Paths to Illustrator command does not honor the "Override Action Save As" checkbox, which means I'm just stuck with that shortcoming of Photoshop.

2012/11/21
1
1
11/21/2012 12:08:00 PM

One way to work with this is to use scripting (applescript, vbscript, javascript). Phtoshop exposes the export command (exportDocument (exportIn [, exportAs][, options])) (see for instance adobe's document photoshop_cs4_javascript_ref.pdf ) and so all you need to do is open a document and then feed the command a destination filename and options.

A quick google search brought me to this script from Photoshop for Geeks (http://www.tranberry.com/panels/) NOT MY CODE:

// openFolderTemplate.jsx
// Copyright 2007
// Written by Jeffrey Tranberry
// Photoshop for Geeks Version 1.0

/* 
Description:
This script is a template script that will
open and process a folder of images
*/

// enable double clicking from the 
// Macintosh Finder or the Windows Explorer
#target photoshop

// Make Photoshop the frontmost application
// in case we double clicked the file
app.bringToFront();


///////////////////////////
//       SET-UP          //
///////////////////////////


// A list of file extensions to skip, keep them lower case

    gFilesToSkip = Array( "db", "xmp", "thm", "txt", "doc", "md0", "tb0", "adobebridgedb", "adobebridgedbt", "bc", "bct" );


// Pops open a dialog for the user to
// choose the folder of documents to process

    var inputFolder = Folder.selectDialog("Select a folder of documents to process");


// Pops open a dialog for the user to
// set the output folder

    var outputFolder = Folder.selectDialog("Select a folder for the output files");



///////////////////////
//         MAIN          //
//////////////////////



// Open Folder of Images

    OpenFolder();


// show the path to an output folder

    alert(outputFolder);



///////////////////////////
//       FUNCTIONS       //
///////////////////////////



// Given the a Folder of files, open them

function OpenFolder() {
        var filesOpened = 0;
        var fileList = inputFolder.getFiles();
        for ( var i = 0; i < fileList.length; i++ ) {
                   // Make sure all the files in the folder are compatible with PS
                if ( fileList[i] instanceof File && ! fileList[i].hidden && ! IsFileOneOfThese( fileList[i], gFilesToSkip )) {
                        open( fileList[i] );
                        filesOpened++;


                    /////////////////////////////////////
                    // Put all your processing functions... //
                    /////////////////////////////////////

                        // Alert and show the document name
                        alert(app.activeDocument.name);

                        // Cloes the file without saving
                        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

                    ////////////////////////////////////////////
                    // ...in the area between these two comments. //
                    ////////////////////////////////////////////


                }

        }
        return filesOpened;
}


// given a file name and a list of extensions
// determine if this file is in the list of extensions

function IsFileOneOfThese( inFileName, inArrayOfFileExtensions ) {
    var lastDot = inFileName.toString().lastIndexOf( "." );
    if ( lastDot == -1 ) {
        return false;
    }
    var strLength = inFileName.toString().length;
    var extension = inFileName.toString().substr( lastDot + 1, strLength - lastDot );
    extension = extension.toLowerCase();
    for (var i = 0; i < inArrayOfFileExtensions.length; i++ ) {
        if ( extension == inArrayOfFileExtensions[i] ) {
            return true;
        }
    }
    return false;
}

You can pick a source and destination folder, and the script will enumerate the files. You can then insert your own function to do magic.

2012/06/19
1
6/19/2012 3:01:00 PM