1

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.

4
  • How familiar are you with javascript etc.?
    – horatio
    Jun 14, 2012 at 20:09
  • It's not my first language, but I get along. Part of the end goal of these scripts is to get path strings I can use in Raphael.js.
    – pjmorse
    Jun 14, 2012 at 23:46
  • OK, see my answer.
    – horatio
    Jun 19, 2012 at 15:01
  • Downvotes: care to offer constructive criticism?
    – pjmorse
    Nov 21, 2012 at 12:07

2 Answers 2

1

Choose a destination folder (last not-grayed out option) then choose ' override action save as' below it. You can see that below that, it says 'Starting serial#' which indicates it'll name each file with a next number.

13
  • Hmm. I tried this, and I get the same behavior as before. I'll add a screen shot of the action I'm running, maybe that will help...
    – pjmorse
    Jun 14, 2012 at 18:53
  • Strange it works for me.. It's probably a little detail you're doing differently.
    – paddotk
    Jun 14, 2012 at 18:55
  • Yeah, that little detail is what I need to figure out. :( If only I could edit the action directly!
    – pjmorse
    Jun 14, 2012 at 19:01
  • Can you post a screen shot of your batch dialog so I can look for differences?
    – pjmorse
    Jun 14, 2012 at 19:30
  • 1
    I think "export" does not honor the "save-as override" since it is not a "save as" command. I do know from personal experience that a "save for web" action is not affected by this
    – horatio
    Jun 14, 2012 at 20:01
1

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.

3
  • Does that also work for Illustrator? ^
    – user20375
    Mar 3, 2014 at 6:50
  • Illustrator does support scripting, but my guess is that the script above would not work without alterations in illustrator. Adobe hosts documentation about the scripting model in general and for individual products.
    – horatio
    Mar 4, 2014 at 15:38
  • @user20375 - I submitted an edit to the answer for the Photoshop scripting reference, but here's the corresponding link for Illustrator (adobe.com/devnet/illustrator/scripting.html). Since Illustrator doesn't open files quite the same way as PS, line 16 (#target photoshop) and line 77 (open( fileList[i] );) would change, and obviously your specific action/processing.
    – MandisaW
    Mar 21, 2015 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.