2 Replies Latest reply on Mar 5, 2010 12:59 PM by uDesign

    cs4 Relinking files with new names

    uDesign

      Hi all,

       

      Is there a way i can find and replace the file name for my linked files?

       

      I have a catalog with about 90+ linked illustrator files that i need to replace.

      All files are named as followed:

      ####_AA.ai

       

      I just need to change "AA" to "BB" while keeping #### and the extension the same.

       

      I tried searching for scripts that might help with this, but the ones i found all give me an error message.

       

      I am running CS4 on OSX 10.5.8

       

      Any help is greatly appreciated.

       

      I am a novice when it comes to coding though.

       

      TIA

        • 1. Re: cs4 Relinking files with new names
          Kasyan Servetsky Level 5

          This is a very basic script — written on CS3 for Windows, hope it works for CS4 as well. I assume that '_AA' and '_BB' files located in the same folder.

           

          var myImages = app.activeDocument.allGraphics;
          for (i = myImages.length-1; i >= 0 ; i--) {
              var myLink = myImages[i].itemLink;
              var myNewName = myLink.filePath.replace(/_AA.ai$/, "_BB.ai");
              var myNewLink = new File(myNewName);
              if (myNewLink.exists) {
                  myLink.relink(myNewLink);
                  try {
                      myLink.update();
                  }
                  catch(e) {}
              }
          }

          • 2. Re: cs4 Relinking files with new names
            uDesign Level 1

             

             

             

            Sorry for the incredibly late reply.

             

            This worked for me using cs4 on osx.

             

            Thanks a lot!!