Skip navigation
RP911
Currently Being Moderated

Changing art file names without reimporting?

Mar 23, 2013 10:43 AM

I have a book project just completed with about 150 pieces of art imported ... the publisher would like the art file names appended with the book title on them. I can do that easily enough in Bridge, but is there a way to accomplish this within InDesign so all 150 won't show up as missing and have to be reimported? Thanks!

 
Replies
  • Currently Being Moderated
    Mar 23, 2013 1:47 PM   in reply to RP911

    I've moved this from the general discussions to the scripting forum. If there's a solution, it's more likely these folks will have it.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2013 4:02 PM   in reply to RP911

    Hi,

     

    I can see 2 ways:

     

    1. you prepare a copies of files with changed names and script could relink all graphics

    2. script could embed each graphic and unembed it to a new file with new name created in a new or chosen folder

     

    both solutions need more info from your side

     

    rgds

    Jarek

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 24, 2013 10:57 AM   in reply to RP911

    Hello,

     

    Here's a solution I used for myself in a similar situation to yours. The approach is similar to what Jarek suggests in #1. This script should relink all graphics including anchored/inline graphics and multiple instances of the same link. It puts the links in the format listed below (which you can change). Assuming your document name is "test.indd":

     

    links are named:

     

    test_originalNameofLink.ext

     

    Lindsay

     

     

    //set active document
    var doc = app.activeDocument;
     
     
    //set document name
    var docName = doc.name.split(".")[0];
     
     
    //set destination folder
    var destFolder = "~/Desktop/test/";
            
    //count links
    linkCount = doc.links.length;
     
     
    //loop through links
    for (i=linkCount-1; i>=0; i--) {
        
        //get current link name
         var currentLink = doc.links[i];
         var clFullName = currentLink.name;
         var clFullNameCount = clFullName.length;
         var clName = clFullName.split(".")[0];
         
         //get current link file path
         var clFilePath = currentLink.filePath;
         var clFilePathCount = clFilePath.length;
         var clFilePathSplitList = clFilePath.split (":");//<--- the colon is specific to mac file paths change to / for windows
         var clFilePathListCount = clFilePathSplitList.length;
         var clFileName = clFilePathSplitList[clFilePathListCount-1];
         var clFileNameCount = clFileName.length;
         
         //check for link status
         if (currentLink.status == LinkStatus.NORMAL) {
       
                 //set filename without document name
                 var clNameNoPrefix = clFullName;
                 
                 //set relink destination folder & filename
                 var reLinkDest = destFolder + docName + "_" + clNameNoPrefix;
                 
                 //set relink destination file
                 var relinkDestFile = File (reLinkDest);
                          
                 //check if link is named and relinked
                 if (!relinkDestFile.exists) { 
                     
                     //relink file
                     currentLink.copyLink (new File (reLinkDest));
                     
                     //relink to already existing file
                     } else if (reLinkDest != clFilePath && relinkDestFile.exists) {
                         
                         //relink file
                        currentLink.relink (relinkDestFile);
                         
                         };
                 
                  //alert user link is inaccessible
                 } else if (currentLink.status == LinkStatus.LINK_INACCESSIBLE || currentLink.status == LinkStatus.LINK_MISSING || currentLink.status == LinkStatus.LINK_OUT_OF_DATE) {
                     
                     //alert user
                     alert (clFullName + "\n\nThis link is missing, out of date, or inaccessible and can not be updated.")
                     
                     };
     
     
        };
     
     
    alert ("Done.");
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points