2 Replies Latest reply on Aug 12, 2008 8:46 AM by JADarnell

    InDesign  CS2 (Mac) adding a percent sign to an image filename

    JADarnell Level 1
      Hello all:

      I have a small Javascript (I actually obtained from this forum several years ago) that looks like this:

      doc = app.activeDocument;
      var newFolder = Folder.selectDialog('New folder with images');
      var misses;

      misses = 0;

      if (newFolder != null)
      nroflinks = doc.links.length;
      for (i = 0; i < nroflinks; i++)
      if (doc.links[i].filePath !='')
      var NewFile = File(newFolder + '/'+ doc.links[i].name);
      doc.links[i].relink(File(newFolder + '/'+ doc.links[i].name));

      alert("We failed to relink " + misses + " files.");

      It normally works great! It relinks all the links in a single document with one fell swoop.

      Lately, however, some of my customers have been sending in documents with image filenames that look like this:


      which keeps the script from relinking the file.

      Just for the fun of it I escaped the percent sign and tried the script and
      it still did not work.

      Unfortunately we are not allowed to change the filename; we have to more or less leave it alone.

      Does anyone know how to get the Javascript to accept the percent sign in a filename?