2 Replies Latest reply on Aug 8, 2012 6:48 AM by Marijan Tompa [tomaxxi]

    change filename into link


      I want to change the filename of a link into Indesign. For example: the existing filename is table_EX.jpg and now I want it to change into table_CZ.jpg


      I wrote a script, but it seems that it only change ONE link. Who can help me?




      #target indesign

      // Relink file fileName.js


      if (app.documents.length == 0) {

           err("No open document. Please open a document and try again.", true);



      var myDoc = app.activeDocument;

      var myLinks = myDoc.links;

      var myCounter = 0;


      if (myLinks.length == 0) {

           err("This document doesn't contain any links.", true);



      for (i = myLinks.length-1; i >= 0 ; i--) {

           var myLink = myLinks[i];

           var myOldfileName = myLink.name;

           var myNewfileName = myOldfileName.replace("_EX", "_CZ");

           var myNewFile = new File(myNewfileName);

           if (myNewFile.exists) {