Copy link to clipboard
Copied
Can anyone help me generate a script which will relink all images of a particular file type to a file of the same name but of a different format? For example, every linked Illustrator file should be relinked to a PDF or EPS of the same file name (but appropriate file extension of course).
Colin
Hi Colin,
It is already discussed, but here below code for you
var doc = app.activeDocument;
var lk = doc.links;
for(i=lk.length-1; i>=0;i--)
{
lkname =lk.name;
if(lkname.indexOf(".ai")>=0)
{
var lkname0 = lkname.split(".ai")[0];
lkfolder = File(lk.filePath).parent;
myFile = File(lkfolder+"/"+lkname0+".pdf");
if (myFile.exists) {
lk.relink(File(lkfolder+"/"+lkname0+".pdf"));
}}
}
or you can use Kasyan relink image script
http://kasyan.ho.com.ua/relink.html
Shonky
Copy link to clipboard
Copied
Hi Colin,
It is already discussed, but here below code for you
var doc = app.activeDocument;
var lk = doc.links;
for(i=lk.length-1; i>=0;i--)
{
lkname =lk.name;
if(lkname.indexOf(".ai")>=0)
{
var lkname0 = lkname.split(".ai")[0];
lkfolder = File(lk.filePath).parent;
myFile = File(lkfolder+"/"+lkname0+".pdf");
if (myFile.exists) {
lk.relink(File(lkfolder+"/"+lkname0+".pdf"));
}}
}
or you can use Kasyan relink image script
http://kasyan.ho.com.ua/relink.html
Shonky
Copy link to clipboard
Copied
Thank you so much. That works perfectly. Not sure why I couldn't find any reference to a solution, spent the best part of this morning searching. Must not have been looking under the right terms.
Thanks again.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now