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

Relinking multiple instances of the same file Broken?

Engaged ,
Aug 24, 2020 Aug 24, 2020

Copy link to clipboard

Copied

Hey smart people. Is this a bug or am I doing something wrong?

 

When I try to relink multiple instances of the same (missing) file to my illustrator document, it used to be that I could select in the links palette all the links to the same file and then illustrator would bring up the link dialog box for every instance that I had selected. Although it wasn't automated, I only had to double click on the name of the file to link to, and it would cycle to the next one.

 

Today I noticed that when I select mulitple links it only relinks one of them and I have to select each link separately. Am I missing something? Have they changed the way it works? 

 

Please advise, thanks. 

TOPICS
Bug , Import and export

Views

322

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 1 Correct answer

Engaged , Aug 24, 2020 Aug 24, 2020

Holy Moly. It worked as expected this time. Is there a limit to the number of files or something maybe?

 

Votes

Translate

Translate
Adobe
Engaged ,
Aug 24, 2020 Aug 24, 2020

Copy link to clipboard

Copied

Holy Moly. It worked as expected this time. Is there a limit to the number of files or something maybe?

 

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 ,
Jun 17, 2024 Jun 17, 2024

Copy link to clipboard

Copied

This script will replace all links of the same name with a new one of your choosing. 

/**
 * This script replaces all linked files with the same name at one time in Adobe Illustrator.
 * It allows the user to select the link to replace from a list of current links using a drop-down menu
 * and then choose the new file from a dialog.
 */

function replaceAllLinksWithSameName() {
    var doc = app.activeDocument;
    var placedItems = doc.placedItems;
    var linkNames = [];

    // Collect all unique link names
    for (var i = 0; i < placedItems.length; i++) {
        var placedItem = placedItems[i];
        if (placedItem.file) {
            var fileName = placedItem.file.name;

            // Check if the fileName is already in linkNames
            var isUnique = true;
            for (var j = 0; j < linkNames.length; j++) {
                if (linkNames[j] === fileName) {
                    isUnique = false;
                    break;
                }
            }

            if (isUnique) {
                linkNames.push(fileName);
            }
        }
    }

    if (linkNames.length === 0) {
        alert("No linked files found in the document.");
        return;
    }

    // Create a dialog for link selection
    var dialog = new Window("dialog", "Select Link to Replace");
    dialog.orientation = "column";

    var dropdown = dialog.add("dropdownlist", undefined, linkNames);
    dropdown.selection = 0;

    var okButton = dialog.add("button", undefined, "OK");
    okButton.onClick = function() {
        dialog.close(1);
    };

    if (dialog.show() != 1) {
        return;
    }

    var oldFileName = dropdown.selection.text;
    var newFile = File.openDialog("Select the new file to replace " + oldFileName);

    if (newFile) {
        var count = 0;

        for (var k = 0; k < placedItems.length; k++) {
            var placedItem = placedItems[k];
            if (placedItem.file && placedItem.file.name === oldFileName) {
                placedItem.file = newFile;
                count++;
            }
        }

        alert(count + " links have been replaced.");
    } else {
        alert("Operation cancelled or no file selected.");
    }
}

replaceAllLinksWithSameName();

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
Engaged ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

A very late thank you for the script. I don't know how to use scripts, so it will take a minute for me to get up to speed. 

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 ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

LATEST

Unfortunately I cannot get this script to work, but the script from Carlos Canto, that can be found here works for me:

https://community.adobe.com/t5/illustrator-discussions/relink-all-selected/m-p/10758819#M155685

 

Copy the script and paste it into a plain text document (not word or rich text, simple unformatted text).

Save it to the desktop as relinkAllSelected.jsx

Save Copy the script to the Illustrator application folder > Presets > Your Language folder > Scripts (you may need an admin password) and restart.

You can use the script by selecting all the links in your Illustrator file and select File > Scripts > relinkAllSelected from File > Scripts

Alternatively you can select the script from wherever you saved it using File > Scripts > Other Script.

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