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

Relink multiple images in one go

Explorer ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

Hi,

 

Is there a way I can relink a select number of images on a document in one go rather than having to relink one by one?

 

For example, in the image below, the graphic is duplicated 112 times. Let's say I want to replace 50 of the links with a graphic that has a different price on it. At the moment, I have to select the graphics I want to change and then go through the relink procedure 50 times, which is very time-consuming (and incredibly frustrating!)

 

Is there a way to do this within InDesign? Is there a script available? I'm also happy to use Illustrator if there's a way it can be done there, although I haven't found a solution for that either.

 

Thanks for any help you guys can give.

 

Screenshot 2020-03-05 at 09.48.22.png

TOPICS
How to , Import and export , Scripting

Views

19.6K

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

correct answers 2 Correct answers

Explorer , Mar 05, 2020 Mar 05, 2020

Ah, yes sorry, I should have mentioned. Mac OS Catalina, InDesign 15.0.2.

 

That sounds like a viable workaround. I'll use that method if a quicker way doesn't show up!

 

Thanks Eric, much appreciated.

Votes

Translate

Translate
Community Expert , Mar 05, 2020 Mar 05, 2020

This assumes that you have the frames selected with the regular black arrow tool, and that there is only one linked image within that frame:

 

 

var fileToRelink = File.openDialog("Choose the file to relink to");
var selects = app.selection;

for (var i = 0; i < selects.length; i++) {
    selects[i].graphics[0].itemLink.relink(fileToRelink);
}

 

Votes

Translate

Translate
Community Expert ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

Hi,

can you confirm the version of the software and operating system you are using?

 

Here what I would do:

  • duplicate your file
  • in one version of the indd file,
    • I would delete half the images
    • in the Link panel, update the link to the new image
  • In the other version of the indd file, copy the other half of the image
  • paste the second batch into the first version
  • you should get the mix of images on the same page

 

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
Explorer ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

Ah, yes sorry, I should have mentioned. Mac OS Catalina, InDesign 15.0.2.

 

That sounds like a viable workaround. I'll use that method if a quicker way doesn't show up!

 

Thanks Eric, much appreciated.

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
Community Expert ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

Please update this thread if you find a better solution

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
Community Expert ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

This assumes that you have the frames selected with the regular black arrow tool, and that there is only one linked image within that frame:

 

 

var fileToRelink = File.openDialog("Choose the file to relink to");
var selects = app.selection;

for (var i = 0; i < selects.length; i++) {
    selects[i].graphics[0].itemLink.relink(fileToRelink);
}

 

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
Explorer ,
Mar 05, 2020 Mar 05, 2020

Copy link to clipboard

Copied

How do I use this within the InDesign document?

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
Community Expert ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

https://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-po...

 

Once the script is installed, select the frames of the images you want to replace with the selection tool (black arrow), then execute the script. You will be prompted to select the image file you want to relink. The rest is magic. This is a .jsx script (ExtendScript).

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
Explorer ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

Ok, I see now. I've followed the instructions and used TextEdit to save the script, but it doesn't seem to work. I guess maybe I'm doing something wrong?

 

Screenshot 2020-03-06 at 08.32.33.pngScreenshot 2020-03-06 at 08.31.06.png

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
Community Expert ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

Hi Jon,

did you save the script with TextEdit app as Text only?

 

If yes, we have a serious problem with Catalina and ExtendScript scripts in the User folder of the Scripts folder:

In previous versions of OS X a *.jsx file was considered to be owned by the ExtendScript Toolkit app ( ESTK ), but now with OSX 10.15 the ESTK cannot be installed anymore, it is 32-Bit software, so my assumption is that a jsx suffix will not be recognized anymore as what it is, a script that could be run with InDesign ( or other CC apps like Illustrator, PhotoShop etc.pp. ). Usually a orderly saved ExtendScript script that lies in the User folder of the Scripts panel should run with InDesign. Maybe that changed with Catalina? That would be a serious bug with InDesign.

 

FWIW: I cannot test this because I'm not on OS X 10.15 Catalina.

Maybe someone else could test this?

 

A workaround could be to move the script file to InDesign's Script folder of the Application or to the new Community script folder in InDesign's application folder.

 

Regards,
Uwe Laubender

( ACP )

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
Explorer ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

I thought I had saved it as text only but obviously not! I just tried saving the script again and it worked! I must have done something different as the original file that didn't work has 'TXT' in the icon and the new one doesn't.

 

Thanks, everyone for you help. It works a treat and will save me a lot of time in the future!

 

Screenshot 2020-03-06 at 12.35.54.pngScreenshot 2020-03-06 at 12.36.08.png

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
Community Expert ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

Sometimes by default, TextEdit can be set to do the text in RTF format, which would mess up the .jsx coding. To ensure you have it correct in the future, in TextEdit you'd select the text and go to Format > Make Plain Text just to be sure. 

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
Explorer ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

I did actually have the format set to Plain Text. I worked out that in the Save dialog box, I should have 'un-ticked' the option to use .txt if no extension is provided, even though I did put .jsx at the end of the filename when saving.

 

Screenshot 2020-03-06 at 16.33.06.png

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
New Here ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Hi Brian.

 

Is there a trivial fix to make this work for links selected in the Links panel? I have a document with hundreds of duplicated images that need to stay slightly renamed, but they're page design clutter, so they're all over the place rather than in one frame.

 

If it's non-trivial, please don't worry. I was given idml to work from, so I can always look at editing the raw xml -- and thanks either way.

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
New Here ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

(I should probably specify (1) that the original links are all to sub-pages of an illustrator archive, which has now been split into separate updated .psds, so none of the batch solutions I've found so far work; and (2) I'm on CS6 PC.)

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
Community Expert ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Scripting can't read what links are selected in the panel. You can iterate through all links in a doc and try to relink. Not sure how the fact these are subpages of ai files affects things. Check the link name before plugging in replacing the text in the nameOfLinkToReplace variable. I think maybe it should have a a number at the end indicating which page of the ai file it is?

 

var fileToRelink = File.openDialog("Choose the file to relink to");
var selects = app.activeDocument.allGraphics;
var nameOfLinkToReplace = "my-link-name.ai";
var aLink;

for (var i = 0; i < selects.length; i++) {
     try {
        aLink = selects[i].itemLink;
        if (aLink.name == nameOfLinkToReplace) {
            aLink.relink(fileToRelink);
        }
     } catch(e){}
}

 

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
Community Beginner ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

You just gave us a show. Thanks

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
Community Expert ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

Hi Brian,

don't know if it will be relevant, but also see into the following issue if you like to change the visibility of graphic layers of placed AI, PSD, PDF files and InDesign pages:

 

Scripting | graphicLayerOptions : Changing visibility of graphicLayer will change ID number of placed graphic
Uwe Laubender, Jul 24, 2019

https://indesign.uservoice.com/forums/913162-adobe-indesign-sdk-scripting-bugs-and-features/suggesti...

 

See also this post by Marc Autret:

https://community.adobe.com/t5/indesign/activating-object-layers-basing-on-document-layers/m-p/46539...

 

Regards,
Uwe Laubender

( ACP )

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
Community Expert ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

LATEST

I just encountered this bug in another, unrelated project I'm working on. It was driving me crazy. Upvoted! 

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