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

script for changing tif links to jpeg

Explorer ,
Feb 10, 2010 Feb 10, 2010

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

TOPICS
Scripting
2.2K
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 ,
Feb 10, 2010 Feb 10, 2010

If you are on CS4, you can use Relink to Folder feature (found in Links panel).

Or you can use this script.

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
Explorer ,
Feb 10, 2010 Feb 10, 2010

that's not what I want, I want to relink to jpegs, reilink to folder won't work

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
Engaged ,
Feb 10, 2010 Feb 10, 2010

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

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 ,
Feb 10, 2010 Feb 10, 2010

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

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
Engaged ,
Feb 10, 2010 Feb 10, 2010

Hi Kasyan,

Please check your yahoo mail.

Shonky

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
Explorer ,
Feb 11, 2010 Feb 11, 2010

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....

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 ,
Feb 11, 2010 Feb 11, 2010
LATEST

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.

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 ,
Feb 10, 2010 Feb 10, 2010

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.

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