7 Replies Latest reply on Mar 27, 2012 6:52 AM by garisimola

    Batch Change Color Swatch Name in EPS files

    garisimola Level 1

      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-

        • 1. Re: Batch Change Color Swatch Name in EPS files
          CarlosCanto Adobe Community Professional & MVP

          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.");
                    }
          }
          
          • 2. Re: Batch Change Color Swatch Name in EPS files
            garisimola Level 1

            Thanks CC -- I tried the script on a folder with a few EPS files, which didn't recognize the files -- so I edited the script to look for EPS files, but it still didn't work... I see you changed the script for the original (AI); did you make other edits, or just the two lines where EPS is indicated?

             

            -g-

            • 3. Re: Batch Change Color Swatch Name in EPS files
              garisimola Level 1

              PS -- The whole reason I am in this pickle with SpotBlack vs black (vs the protected process color Black) is b/c AI won't let you name anything Black as as spot color (Black where the first letter is capitalized). So I created a spot called SpotBlack and have been using that for 2+ years. However, the rip I use isn't smart enough to realize that SpotBlack = Black, so I have to manually assign it to a specific ink. It wasn't until recently did I realize that I can assign a spot color in AI called 'black' (lowercase 'b') that doesn't upset its sensibilities and works in the rip. So now I have a few (thousands!) files where SpotBlack is indicated. Hence my plea. Back to the point: sometimes when I rename spot colors, even when using the l/c 'b' AI throws up an alert re: protected process color names -- so, I don't know if this is happening here, but it might.

               

              Cheers!

               

              -g-

              • 4. Re: Batch Change Color Swatch Name in EPS files
                [Jongware] Most Valuable Participant

                >.. 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.

                • 5. Re: Batch Change Color Swatch Name in EPS files
                  CarlosCanto Adobe Community Professional & MVP

                  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?.

                  • 6. Re: Batch Change Color Swatch Name in EPS files
                    Muppet Mark Level 5

                    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…

                    • 7. Re: Batch Change Color Swatch Name in EPS files
                      garisimola Level 1

                      Ok, I am an ideeot. I told you SpotBlack and it was really BlackSpot -- I changed the swatch name and bingo! Thank you, Carlos, it worked great.

                       

                      Cheers!

                       

                      -g-