: Updating links based on pageItem name, not based on index of 'links.items' I have a indesign document with several images. I want to update these images with Adobe Indesign Scripting. The following
I have a indesign document with several images. I want to update these images with Adobe Indesign Scripting. The following code works.
var file = new File ('/MyDisk/image01.png');
app.activeDocument.links.item(1).relink (file);
var file = new File ('/MyDisk/image02.png');
app.activeDocument.links.item(2).relink (file);
But you have to know the index of the link you want to change. If you're adding/deleting images on the page, this numbering can change. So I rather use the name of the pageItem itself. But I don't know how to do this.
With textItems, it is easy to refer to a object's name, but to change an image link by referring his name seems not possible.
example:
app.activeDocument.textFrames.item('text frame').contents= 'changed content';
More posts by @Heady304
1 Comments
Sorted by latest first Latest Oldest Best
You can certainly use the name to target a collection's item:
var link = app.activeDocument.links.itemByName("myLink.jpg");
//Get sure the reference exists before any further action
if ( link.isValid ) link.relink ( … )
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.