Copy link to clipboard
Copied
Hi,
I have a file linked to a bunch of tifs. I've run a script in PS converting those images to jpeg. I could manually change each link, but I'd much rather use a script to go through my doc and convert my link urls from *.tif to *.jpg
Has anyone come across a script for this? and if not, I can build one, but I'm having trouble finding the InDesign Scripting Reference pdf. Can someone point me in the direction?
Thanks,
Stan
Copy link to clipboard
Copied
If you are on CS4, you can use Relink to Folder feature (found in Links panel).
Or you can use this script.
Kasyan
Copy link to clipboard
Copied
that's not what I want, I want to relink to jpegs, reilink to folder won't work
Copy link to clipboard
Copied
Hi Stan,
Use below code
var doc = app.activeDocument;
var lk = doc.links;
for(i=lk.length-1; i>=0;i--)
{
lkname =lk.name;
if(lkname.indexOf(".tif")>=0)
{
var lkname0 = lkname.split(".tif")[0];
lkfolder = File(lk.filePath).parent;
myFile = File(lkfolder+"/"+lkname0+".jpg");
if (myFile.exists) {
lk.relink(File(lkfolder+"/"+lkname0+".jpg"));
}}
}
It works with Indesign CS4
Kasyan i have tried with your script it showing error and only relinking one image. I am using CS4.
Shonky
Copy link to clipboard
Copied
Shonky,
I don't have clairvoyant skill — knowing that somewhere some problem occurred with my script is not enough for me to solve it.
I'd like to see a screenshot of the error message. Ideally would be if you would send me files that cause the error at askoldich [at] yahoo.com.
Kasyan
Copy link to clipboard
Copied
Hi Kasyan,
Please check your yahoo mail.
Shonky
Copy link to clipboard
Copied
hey guys, this is great. I like both options! Kasya, please upload your modified script when it's ready. Sounds pretty cool! thank you guys for your help!.
Is there a repository of InDesign scripts online somewhere? if there isn't there oughtta be....
Copy link to clipboard
Copied
I attached a new version of the script, but I haven't properly tested it yet.
Is there a repository of InDesign scripts online somewhere? if there isn't there oughtta be....
Here is Scriptopedia by Loik.
I started a new page on my site where I want to post scripts for download and links to scripts on other sites, sorted by categories.
There are loads of scripts on InDesign Exchange, but some of them are quite outdated — it takes ages to post scripts there.
Copy link to clipboard
Copied
Relink to Folder has an option called Match same filename but this extension, where you can specify the new extension.
For details check out this article.
The script, at first, looks for the link with exactly the same name, and if it's not found, it seeks for a link with the same base name but a different extension (".psd", ".tif", ".jpg", ".ai", ".eps", ".pdf", ".indd"). Thus you can place jpg-files into a different folder (or replace tifs with jpegs) and relink them with script.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now