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

How to delete all instance of a linked object

Explorer ,
Jan 04, 2022 Jan 04, 2022

Hi, guys.

How can i delete all instance of a linked object.

We have these options when we select a linked object in link panel. but what if i need to delete all instance of a linked object?

alllinked.PNG

thank you.

TOPICS
How to
1.4K
Translate
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 ,
Jan 04, 2022 Jan 04, 2022

You cannot - you'd need to go to each image placed and delete it manually.

 

It might be possible with a script or another method that I'm not aware of .

Translate
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
Adobe Employee ,
Jan 04, 2022 Jan 04, 2022

Hi there,

 

Thanks for reaching out. As @Eugene Tyson said, it is not possible in InDesign as of now. I would suggest you post it here (https://indesign.uservoice.com/). This way, you will keep getting all the updates related to this feature, and other users can also upvote, which would help us prioritize. Also, this is the best way of communicating with the Engineering and Product teams regarding issues and suggestions so they can be implemented in future releases.

Regards,
Anshul Saini

Translate
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 ,
Dec 09, 2024 Dec 09, 2024

This is actually a useful idea for the Links panel! I like it.

Mike Witherell
Translate
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
Valorous Hero ,
Dec 09, 2024 Dec 09, 2024

You can do this by the 'Remove all instances of the same link' script.

Translate
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 ,
Dec 10, 2024 Dec 10, 2024

Hi Kasyan,

I was just looking at that script! I wish it could become a Links panel menu choice, perhaps by way of a startup script. I was trying to get ChatGPT to rewrite the script to function that way in the Links panel, but ChatGPT is pretty lame when it comes to writing ExtendScripts.

Mike Witherell
Translate
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
Valorous Hero ,
Dec 10, 2024 Dec 10, 2024

Hi Mike,
It's possible to do — make a script acting as a menu item — but I'm too busy with my daily work to get down to this at the moment.
— Kasyan

Translate
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 ,
Dec 10, 2024 Dec 10, 2024

I can make it a button and it works - stays active on the document - 

I don't know how to make it a an addition in the sub menu panels

Run the script and get a floating button - not hte nicest but I gave it a go

#targetengine "session"

var myWindow = new Window("palette", "Link Tools", undefined);
myWindow.orientation = "row";

// Add a button
var removeButton = myWindow.add("button", undefined, "Remove All Instances");
removeButton.onClick = function () {
    removeAllInstances();
};

myWindow.show();

function removeAllInstances() {
    if (app.documents.length == 0) {
        alert("No documents are open. Please open a document and try again.");
        return;
    }

    var doc = app.activeDocument;
    var links = doc.links;
    if (app.selection.length != 1 || app.selection[0].graphics.length != 1) {
        alert("Select a graphic frame with an image.");
        return;
    }

    var selectedLink = app.selection[0].graphics[0].itemLink;
    if (!selectedLink) {
        alert("Selected item doesn't contain a link.");
        return;
    }

    var filePath = selectedLink.filePath;
    var removedCount = 0;

    for (var i = links.length - 1; i >= 0; i--) {
        if (links[i].filePath == filePath) {
            try {
                var frame = links[i].parent.parent;
                frame.remove();
                removedCount++;
            } catch (e) {
                $.writeln(e);
            }
        }
    }

    alert(removedCount + " links have been removed.");
}

 

Translate
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
Valorous Hero ,
Dec 10, 2024 Dec 10, 2024

Currently, I'm not sure if it's possible to add a menu item to a panel, but I know it's possible in the main and context menu.
For example, assumingly the 'Remove all instances of the same link' script installed in the app's scripts panel folder, the following script (to be installed in the startup scripts folder) would create the Scripts > Remove all instances of the link menu like this:

2024-12-10_16-25-06.png

 

#targetengine "kasyan"

var myScript1 = new File(app.filePath + "/Scripts/Scripts Panel/Remove all instances of the same link 1.0.jsx");
var myScriptAction1 = app.scriptMenuActions.add("Remove all instances of the link");
var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);

try{
	var myScriptMenu = app.menus.item("$ID/Main").submenus.item("Scripts");
	myScriptMenu.title;
}
catch (myError){
	var myScriptMenu = app.menus.item("$ID/Main").submenus.add("Scripts");
}

var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);

 Of course, more menu items pointing to other scripts can be added using the first one as an example.

 

 â€” Kasyan

Translate
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
Valorous Hero ,
Dec 10, 2024 Dec 10, 2024

Here's the code (a start up script) that creates a menu item in the Links panel to trigger the script located in the app's scripts panel folder:

2024-12-10_17-31-58.png

 

#targetengine "kasyan"

var myScript1 = new File(app.filePath + "/Scripts/Scripts Panel/Remove all instances of the same link 1.0.jsx");
var myScriptAction1 = app.scriptMenuActions.add("Remove all instances of the link");
var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);

try{
	var myScriptMenu = app.menus.item("Links Panel Menu");
	myScriptMenu.title;

	if (myScriptMenu.isValid && myScript1.exists) {
		var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);
	}

}
catch (myError){}

 

There's more space for improvement but that's where I've got so far.
P.S. This version works only in English locale.

Translate
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 ,
Dec 11, 2024 Dec 11, 2024

Super interesting and thanks for your replies.

Kasyan, the first script worked for me but the second one did not.

I like the basic idea, though!

Mike Witherell
Translate
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
Valorous Hero ,
Dec 19, 2024 Dec 19, 2024

Here I updated my script. Now, it's a single script that should be installed in the start-up folder.

It should work in non-English versions (locales) of InDesign. I tested it in version 2024/5 on Mac & Windows and it works for me.

Translate
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 ,
Dec 19, 2024 Dec 19, 2024
LATEST

Hi Kasyan,

Thanks for this script. It is a completely satisfying addition to the Links panel!

Also, it works fine when installed in the User versus the Application. 

It undoes in one step--always a nice touch. I give it two thumbs way up!

This will definitely go in my "Anytime Upgrades" startup scripts recommendations.

Mike Witherell
Translate
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