Copy link to clipboard
Copied
Hey guys.
I need help selecting links in the panel. Is there any script (or can someone help me create it) so that I can select the links in my document only in the links panel? And I also need the script to select only links that have a piece of the indd file name in their name.
Ex:
My indesign file has the name: "teste_name.indd"
My links have names:
test_name_img1.jpg
test_name_img2.jpg
test_name_img3.jpg
img_10
img_11
Then, the script will select only the links in the panel ((because these files (in the panel) are the ones whose name is the same as the file name.))
can anybody help me?
I could only think of this, but it doesn't work:
var doc = app.activeDocument;
for (var d = doc.links.length-1; d >= 0; d--) {
var link = doc.links[d];
app.select(link);
}
can anybody help me? I would need this script to add to another larger one that I am creating.
Exemple in image.
Copy link to clipboard
Copied
What do you want to do with the link after you select it? Do you want to manipulate its parent frame, or something else? You can't select across multiple spreads, so just selecting, even as an ADD TO SELECTION would not work. To test the name of the indd doc against the link name, you could try the following:
var doc = app.activeDocument;
var nm = new RegExp(doc.name.replace(/\.indd$/i,""),"i");
for (var d = doc.links.length-1; d >= 0; d--) {
var link = doc.links[d];
if (nm.test(link.name) {
//do something with link. link.parent would get its frame
}
}
Copy link to clipboard
Copied
these links will be relinked to another local folder. It's just a way to automate, as the other links that I didn't select will be relinked by other files.
Copy link to clipboard
Copied
If you want to relink to another folder, then use my snippet above and in the comment block, try something like:
link.relink(File(someFolder +"/" + link.name);
Copy link to clipboard
Copied
It's just a way to automate, as the other links that I didn't select will be relinked by other files.
By @eusoujpg
you'll need to "select" the desired links in your script because, as it was mentioned, there's no way to select specific links in the Links panel via scripts. that is, your script will need to obtain the list of document links, filter it according to your requirements for the link names, then act upon the found links (relink them or anything else you need to do).
Copy link to clipboard
Copied
Hi @eusoujpg , If by select you mean you want to select the items in the Link panel’s list (not select the linked assets on the pages), that can’t be done via scripting
Copy link to clipboard
Copied
As already mentioned script rarely has any capability like selecting objects to do anything on the native panels. So you will need to let us know what you want to do after selecting the items we could explore the possibility of acheiving that.
-Manan
Copy link to clipboard
Copied
Well, always is the way...
I am not scripter but..... scripters can use this approach:
Select your links in link's panel, then script will generate captions, and will group captions with links (Frame on page). Then script will search links name in this captions frame and delete whole group. So I bet, this is possible 🙂
Convince me it's not possible 🙂
Yt/DtptutorialyCZ
Copy link to clipboard
Copied
Select your links in link's panel,
There's no method in the scripting API that will get the panel's selected links. If there are linked objects on a spread that have been selected, then yes.
Copy link to clipboard
Copied
ok, "i made" this script:
https://youtu.be/2BUeYBS8NQY
with this guy
https://www.corullon.com.br/scripts/
So contact him for more info 🙂
Copy link to clipboard
Copied
The script is removing links from the document, which I don’t think is what @eusoujpg is asking for.. The request is to script the selection of a range of items in the Links panel’s list (which might be on different spreads):
Before running:
After:
Copy link to clipboard
Copied
Yes, that's it! these links will be relinked to another local folder. It's just a way to automate, as the other links that I didn't select will be relinked by other files.aS
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OK. I know how it is done - After Link is selected - Invoke can be used.
If only one link is selected:
Copy link to clipboard
Copied
After Link is selected - Invoke can be used.
Maybe @eusoujpg can confirm, but I don’t think there is a selection in the Links panel before the run—the script needs to make the selection of a range of items.
Copy link to clipboard
Copied
After Link is selected - Invoke can be used.
Maybe @eusoujpg can confirm, but I don’t think there is a selection in the Links panel—the script needs to make the selection of a range of items.
By @rob day
If you select few items on the list - this will return list of selected links:
| Copy Info for Selected Links | Copy Info for Selected Links | Panel Menus:Links |
132619 |
But there is a problem - it will return just the name of the file - with path if you enable it in options.
Solution with generating Captions is correct - will create captions for ONLY selected instances:
Copy link to clipboard
Copied
If you select few items on the list - this will return list of selected links
But there is no selection @eusoujpg wants to script a the selection
Copy link to clipboard
Copied
Select your links in link's panel, then script will generate captions, and will group captions with links (Frame on page). Then script will search links name in this captions frame and delete whole group. So I bet, this is possible 🙂
Convince me it's not possible 🙂
By @DTPtutorialyCZ-L.Zalesky
Instead of generating captions - and doing extra processing - Invoke from the Copy Info can be used:
| Copy All Link Information | Copy All Link Information | Panel Menus:Links | 132618 |
| Copy Full Path | Copy Full Path | Panel Menus:Links | 132623 |
| Copy Info Field | Copy Info Field | Panel Menus:Links | 132649 |
| Copy Info for Selected Links | Copy Info for Selected Links | Panel Menus:Links | 132619 |
You are right - the idea with generating Captions is much better.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more