Skip navigation
Currently Being Moderated

Batch Change Color Swatch Name in EPS files

Mar 20, 2012 8:19 AM

Hi all -- I have a couple thousand AI authored EPS files with a specific swatch name (SpotBlack) that I would like to rename (black) -- is there any method to do this en masse, preferrably outside of Illy using a text editor?

 

Thanks for your thoughts!

 

-g-

 
Replies
  • Currently Being Moderated
    Mar 24, 2012 12:35 AM   in reply to garisimola

    try with a couple of files first, before you run a gazillion of them.

     

    var folder = Folder.selectDialog("Select Source Folder..."); // select folder
     
     
    if (folder==null) {
                        alert("Good Bye");
    }
     
     
    else {
              var files = folder.getFiles ("*.eps");
              var fileCount = files.length;
     
     
              if (fileCount>0) {
                        for (i=0; i<fileCount; i++) {
                                  var idoc = app.open(files[i]);
                 try {
                        var iswatch = idoc.swatches["SpotBlack"];
                        iswatch.name = "black";
                  }
                catch (e){}
     
                idoc.close(SaveOptions.SAVECHANGES);
                idoc = null;
                        }
              }
              else {
                        alert("There are no EPS files in this folder.");
              }
    }
    
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2012 12:59 PM   in reply to garisimola

    >.. preferrably outside of Illy using a text editor?

     

    If (a) you are on a Mac and (b) you are SURE all of these EPSes contain pure EPS text (*no* binary information *at all*) -- then you could take look at TextWrangler. It's a straight-on plain text editor (hence, no binary data embedded in your files please) for the Mac (hence, uh, the "Mac required") and it has the option of doing find-and-replaces on a selection of files.

     

    As with Carlos' script: make sure you have a copy of the entire set of files before you let it rip through them.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2012 2:39 PM   in reply to CarlosCanto

    I have to confess I kind of cheated, I wrote the script and tested it with AI files, and it was after I posted that I realized you needed eps, then I just assumed it would work and just edited my post to read eps, without testing.

     

    anyway, I just tested with eps I created and it works as expected.

     

    can you share a couple of samples so we can have a look and try to find out why is not working on your end?.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 1:19 AM   in reply to CarlosCanto

    Carlos, it worked here too… I usually pass a regex to getFiles() but the string appeared to work… Do the files end with the extension or do they have it hidden…

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points