3 Replies Latest reply on Sep 21, 2009 3:01 AM by tynan

    Update path names in links script

    Kasyan Servetsky Level 5

       

      Hello all

       

      Back to Kasyan's script to relink pictures ...

       

      I've been using it alot and brill

       

      I'm now trying to use it to relink pictures where only the core name is the same

       

      So I have a link referring to sample.jpg and I need to link to sample_C.jpg

      And also sample2_.jpg to sample2_C.jpg

      And also sample2.jpg to sample2_USA_C.jpg

      and so on

       

      I changed the array of extentions to the following

       

      var myExtentions = ["_C.jpg", "C.jpg", "LaosCam_C.jpg", "_LaosCam_C.jpg", "_LaosCam_C.JPG", "_LaosCam_C.tif", "_LaosCam_C.eps", "eps", "tif", "jpg", "eps", "tif", "psd", "epsf", "pdf", ""];

       

      Now the annoying thing is that it works perfectly but only for the first member of the array. If I shuffle the necessary members in turn to the front of the array and run the script again it gets there but I can;t see why it won't run through all the members as it should/

       

      I redownlaod the script again and changed only that one line but no dice

       

      So close and so far, I'd be ever so grateful if someone can give a clue as why that doesn't work

       

      Thanks

      Tynan

       

       

      Hi Tynan,

       

       

      I'm posting the answer to your question in a new thread since it has nothing to do with FindChangeByList script and I don’t want to confuse readers of this forum.

      I remade the script a little for you: added an array that lists all possible suffixes — you can add/remove them as needed.

      var mySuffixes = [ "_C", "C", "_USA_C", "_USAOTR_C", "_USAOTR_C" ];

       

      Now, if script doesn't find the file with the exact name, it loops through all suffixes from mySuffixes array:

      Basename + Suffix + Extention

       

      Then, if it is not found, it loops through all extentions from myExtentions array:

      Basename + Extention

       

      Warning! It's totally untested.

       

       

       

      If you ever manage to make this script run on all open files, I'll die of gratitude

       

      In the future, I'm going to make the script that works on all open files and all files from a selected folder as well. Also I'm about to make it to create a report on the desktop, so that a user could see which files were relinked and which not. But I'll do this when I have free time — scripting is just hobby for me and I can't busy myself with it as much as I want.

       

       

      Kasyan

        • 1. Re: Update path names in links script
          tynan Level 1

          Thank-you so much Kasyan and apologies for latching onto the wrong thread, my bad at the end of a long and trying week

           

          What was I doing wrong though? I notice that you leave out the '.', my very limited reading of the line where you split the picture name to remove the extention lead me to believe that the new base name no longer had the ''." on it and it needed to be part of the extention name in the array?

           

          var myInDesignVersion = Number(String(app.version).split(".")[0]);

           

          And why did it work for the first array member but not the others?

           

          I'll not be upset at all if you're too busy to answer any of those doubtless nood questions

           

          Thank-you so much for your time on this, it's going to a real coup for me if it works, as for untested? ha! Any idea how many versions of your script I have now that didn;t quite work?

           

          I think I'm starting to barely start to understand javascript ...

           

          I'm going to not die of gratitude now so I can save myself for the version that does all open files and remebers the graphic folder and even does a text report.

           

          Cor!

           

          Thanks once again Kasyan!

           

          Tynan

          • 2. Re: Update path names in links script
            Kasyan Servetsky Level 5

                                               

            It's hard for me to find this out, without actually running the script against your document. If the last version of the script doesn't work for you, post/send me a zipped sample indd-document with low res images.

             

             

            Actually I even didn't try to sort it out, because what you are trying to achieve, I think, requires a little different approach.

            There was a long discussion on this script about a year ago — http://forums.adobe.com/thread/288209?start=50&tstart=0, where people gave me some interesting ideas of how to improve it: batch process all files in a book, selected folder, etc.

             

            But there's only one thing left — find a little time to do this.

             

            Kasyan

            • 3. Re: Update path names in links script
              tynan Level 1

              HI Kasyan

               

              Understood, fine, it was on the off chance that you'd know straight away

               

              I'm using the new version you kindly supplied and it's certainly working, I'm not completely convinced that it's picking up all the permutations but that might be down to dodgy characters in the file names, some of the hires image names from the Image Libraries are different to the positionals they supply initially and I suspect that sometimes there's html type characters in there that look the same but aren't, sigh

               

              I'll give full and proper feedback once I've had the chance to test properly

               

              And there's absolutely no need to excuse your time available to help out people with their problems, dear god

               

              Thanks Kasyan

              Tynan