• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
0

Is there a way to use linked file that change name when updated?

New Here ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

Hi,

I producing manuals that contain a spare parts list with a lot of drawings.

The drawing files are in pdf format and are automatically generated from AutoCAD.

These pdf drawings I place in my InDesign file.

Unfortunately these files change names with a suffix when they are updated.

The namning of these files are NNNNNN-A for revision A, NNNNNN-B for revision B and so on.

So when I open my InDesing files there aren't any warnings that some files are updated because InDesign of course checks the links and looks for NNNNNN-A and sees that nothing has happened to that file.

But AutoCAD has generated a new updated file with a new suffix"B": NNNNNN-B.

 

So I was wondering if there is a way for InDesign to see that a file has a new suffix "B" and recognize it as the updated revision of the file with the "A" suffix and let me know that there is an updated file?

 

Regards,

Magnus

 

TOPICS
How to , Scripting

Views

97

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

LATEST

Hi Magnus,
The solve is posted here, all credit goes to Mike Bro. I only changed the regex to suit your ask and added the LINK_MISSING loop.
https://community.adobe.com/t5/indesign-discussions/indesign-script-to-relink-the-images-to-match-wi...
The caveat is that prior to running it. you need to move the outdated files out of the link folder so that their Link Status are shown as MISSING. This basically look for a the NNNNNN- pattern and relink to any file that matches it, ignoring the suffix (A, B, C). You can modify the number of prefix letters and/or use 1, 2, 3 instead. 

var doc = app.documents[0];

sourceFolder = Folder.selectDialog("Select a Source Folder");
if (sourceFolder != null){
}else{
exit();
}

var myFilesToLink = sourceFolder.getFiles();

// try {
for(var i = 0; i < doc.links.length; i++){ 

  for (var i = 0; i < doc.links.length; i++){ 
  if (doc.links[i].status == LinkStatus.LINK_MISSING){

  if (doc.links[i].name.match(/^(\w{6}\-)\w\.[a-z]+$/gi,)){ 
  var myLinks = doc.links[i];
  var myLink = doc.links[i].name.replace(/^(\w{6}\-)\w\.[a-z]+$/gi, '$1');
  
    for (var f = 0; f <myFilesToLink.length; f++) {
     if (myFilesToLink[f].name.match(/^(\w{6}\-)\w\.[a-z]+$/gi,)){ 
      var myRevisedFile = myFilesToLink[f];
      var myFilesToLinkName = myFilesToLink[f].name.replace(/^(\w{6}\-)\w\.[a-z]+$/gi, '$1');

     if (myFilesToLinkName.match(myLink)) {              
        myLinks.relink(myRevisedFile);
          }
       }
    }
  }
}
}
}



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines