Highlighted

Change Link Images

New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi All,

i have this problem:

all images were in folder: T:\RacPnt\2020

es: T:\RacPnt\2020\Big\Logo.png

 

And now, path is changed to:

T:\RaccoltaPunti\2020

es: T:\RaccoltaPunti\2020\Big\Logo.png

 

Is it possible to change a part of link for all resource at once time?

Thanks.

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

I quickly put a script that should do the trick, what it needs is the base path fragment that needs to be changed and the path that is to be used. These two variables are defined at the top of the script. So for you the script would be as follows

 

 

var changeWhat = new RegExp("^T:\\RacPnt")
var changeTo = "T:\\RaccoltaPunti"
for(var i = 0; i < app.activeDocument.links.length; i++)
{
	var ln = new File(app.activeDocument.links[i].filePath).fsName
	var a = ln.replace(changeWhat, changeTo)
	try{
	if(ln != a)
		app.activeDocument.links[i].relink(new File(a))
	}catch(e)
	{alert("Could not relink to " + a)}
}

 

 

You can change the variables changeTo and changeWhat as per your need, i have made changes as per your example

 

-Manan

TOPICS
How to

Views

157

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Change Link Images

New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi All,

i have this problem:

all images were in folder: T:\RacPnt\2020

es: T:\RacPnt\2020\Big\Logo.png

 

And now, path is changed to:

T:\RaccoltaPunti\2020

es: T:\RaccoltaPunti\2020\Big\Logo.png

 

Is it possible to change a part of link for all resource at once time?

Thanks.

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

I quickly put a script that should do the trick, what it needs is the base path fragment that needs to be changed and the path that is to be used. These two variables are defined at the top of the script. So for you the script would be as follows

 

 

var changeWhat = new RegExp("^T:\\RacPnt")
var changeTo = "T:\\RaccoltaPunti"
for(var i = 0; i < app.activeDocument.links.length; i++)
{
	var ln = new File(app.activeDocument.links[i].filePath).fsName
	var a = ln.replace(changeWhat, changeTo)
	try{
	if(ln != a)
		app.activeDocument.links[i].relink(new File(a))
	}catch(e)
	{alert("Could not relink to " + a)}
}

 

 

You can change the variables changeTo and changeWhat as per your need, i have made changes as per your example

 

-Manan

TOPICS
How to

Views

158

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

Select a link in the links panel to relink, in the dialog that appears select the option "Search for missing links in this folder"

 

For details refer the following link, refer the section "restore missing links"

https://helpx.adobe.com/indesign/using/graphics-links.html

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi Manan, thanks for help.

The problem is what has changed is only the beginning of the link.

In my example:

Before: T:\RacPnt\2020\Big\Logo.png

After: T:\RaccoltaPunti\2020\Big\Logo.png

 

But obviously i have many under folders and many links (more than 100).

So for the next resource is for exaple:

Before: T:\RacPnt\2020\Little\Logo.png

After: T:\RaccoltaPunti\2020\Little\Logo.png

 

Following your method, i have to repeat this process many times, one for each subfolder.

I'll get crazy.

I ask if it is possible to change the start of the route for all connections.

 

Thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

what are you trying to accomplish?
Do you want to relink all images at once from the new folder?

If yes, select any missing link in your link panel > relink > select that image and tick bellow "Search for missing link in this folder"

Schermata 2020-06-18 alle 09.53.19.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi Vladan, thanks for help.

The problem is what has changed is only the beginning of the link.

In my example:

Before: T:\RacPnt\2020\Big\Logo.png

After: T:\RaccoltaPunti\2020\Big\Logo.png

 

But obviously i have many under folders and many links (more than 100).

So for the next resource is for example:

Before: T:\RacPnt\2020\Little\Logo.png

After: T:\RaccoltaPunti\2020\Little\Logo.png

 

Following your method, i have to repeat this process many times, one for each subfolder.

I'll get crazy.

I ask if it is possible to change the start of the route for all connections.

 

Thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

Ok that would need a script then, i think i have seen one such script by Kasyan. I will post if i am able to locate it

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

I agree with you, i think i need a script.

If you find a script i'll use.

Thank you really much.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

on mac:

select all your folders > right click > rename "number of folders" elements > change text

Schermata 2020-06-18 alle 10.57.35.pngSchermata 2020-06-18 alle 10.57.43.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

This i did.

Now i have to inform Indesign of the new link.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

I quickly put a script that should do the trick, what it needs is the base path fragment that needs to be changed and the path that is to be used. These two variables are defined at the top of the script. So for you the script would be as follows

 

 

var changeWhat = new RegExp("^T:\\RacPnt")
var changeTo = "T:\\RaccoltaPunti"
for(var i = 0; i < app.activeDocument.links.length; i++)
{
	var ln = new File(app.activeDocument.links[i].filePath).fsName
	var a = ln.replace(changeWhat, changeTo)
	try{
	if(ln != a)
		app.activeDocument.links[i].relink(new File(a))
	}catch(e)
	{alert("Could not relink to " + a)}
}

 

 

You can change the variables changeTo and changeWhat as per your need, i have made changes as per your example

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

Did you tried this script? For you it works?

I tried but didn't work for me.

 

I correctly inserted the script oon the folder (extension? i set ".jsx").

I run it but nothing happen.

 

Obviously i changed the path as your indication.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

Tested it on my MAC did work. Can you share a video showing the script you finally run, the original image location, the new image location. Maybe i might observe the issue, if this does not work i will test it on a Win machine

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

I think is a problem of windows.

I wrote some alerts to check the script:

 

var ln = new File(app.activeDocument.links[i].filePath).fsName
var a = ln.replace(changeWhat, changeTo)
alert(changeWhat)
alert(changeTo)
alert(a)

 

Alert with "changeTo" and "a" variable are correct; but variable "changeWhat" not.

Alert wrote this:

 

/^T:\RacPnt/

 

I think there are 3 characters in excess: the first 2 and the last.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0
Adobe Community Professional ,
Jun 18, 2020

Copy link to clipboard

Copied

No the characters are fine, it denotes the regex object

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 18, 2020 0