Indesign - Update links

Post Reply
Dalgas
Newbie
Posts: 5
Joined: Thu Oct 28, 2021 2:43 pm

Indesign - Update links

Post by Dalgas »

Hi'

Switch - Indesign configurator.
Have an Indesign file that should open > update links > Export as .pdf.

The update links, i can't get to work.

First i tried the »re-link all graphics« option in the configurator. - Not working.

Then i tried to use a Javascript, that works in Indesign. - The script returns with error:
Apple script execution has encountered an error: ERROR: No documents are open./::/STATUS=error
Script returned error: ERROR: No documents are open.

Think this should be a simple action, hmmm...

WARNING - I'am not a »Scripting-guy«

Thanx' :)
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Indesign - Update links

Post by freddyp »

Scripts that work in Indesign will not work in the Switch context without modification.

Javascripts for applications have to follow a couple of rules that you can find in the documentation here: https://www.enfocus.com/manuals/UserGui ... tions.html. The changes are usually small.

I guess you are submitting a single Indesign file and not a package, right?
Dalgas
Newbie
Posts: 5
Joined: Thu Oct 28, 2021 2:43 pm

Re: Indesign - Update links

Post by Dalgas »

Okay' i see' - and yes, it's a single Indesign file.

The script i have downloadet from kasyan.ho.ua, is:

Code: Select all

if(app.documents.length == 0){
	alert({en: "No documents are open. Please open a document and try again.", ru: "Не открыт ни один документ, откройте файл и попробуйте снова."});
	exit();
}
else {
	var myDoc = app.activeDocument;
	updateLinks();
}
function updateLinks(){
	for(var myCounter = myDoc.links.length-1; myCounter >= 0; myCounter--){
	var myLink = myDoc.links[myCounter];
		if (myLink.status == LinkStatus.LINK_OUT_OF_DATE){
			myLink.update();
		}
	}
}
Will this be easy to adjust?
Do i need the Error handling, or can i »just« give the variables a new name?

Thanx!
Dalgas
Newbie
Posts: 5
Joined: Thu Oct 28, 2021 2:43 pm

Re: Indesign - Update links

Post by Dalgas »

Maybe someone have an example-script i can see - to help me adjust the script?
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Indesign - Update links

Post by jan_suhr »

If the update link doesn't work in the Configurator it is usually because the path to the links in the InDesign document isn't found by Switch.

If you are getting the files from a customer the path in the document points to the customers server which Switch doesn't have any connection to.

Best way to solve this is if the customer saves the InDesign document as a package with the links saved in the package folder. If you then enters this package folder to Switch the links will update since Switch knows where the links are in relation to the InDesign document.

Have you tried this?
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
Dalgas
Newbie
Posts: 5
Joined: Thu Oct 28, 2021 2:43 pm

Re: Indesign - Update links

Post by Dalgas »

Thanks for reply!

In this case, it's one indesign file located on the server with one .pdf link located on the server.
The .pdf it getting replaced in the same location/path.
If i open the document on the server > update - it will update whitout problems.
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Indesign - Update links

Post by jan_suhr »

And Switch has access to that server?

What does the logs (Messages button) say, have you activated Debug in the preferences under "Logging"?

You should then see some messages telling you what goes wrong with the updating of links.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: Indesign - Update links

Post by freddyp »

There is a fundamental problem in the setup because the Indesign file in Switch is not next to the PDF file so even with a modified script it would not work just like that.

You could modify the script so it goes out to look for missing links in some location. That is the most difficult approach.

You could submit the Indesign file and the PDF into a flow, either already in one folder or you assemble them into a folder. When you then update the links it will probably work. The script that you found online of course does not work in Switch. Without having tested it, I would say it has to look like this:

Code: Select all

for(var myCounter = $doc.links.length-1; myCounter >= 0; myCounter--){
	var myLink = $doc.links[myCounter];
	if (myLink.status == LinkStatus.LINK_OUT_OF_DATE){
		myLink.update();
	}
}
Or you could submit the Indesign file, inject the PDF into the flow with e.g. the Inject wildcard app, assemble both into a folder and run the same script as above.
Dalgas
Newbie
Posts: 5
Joined: Thu Oct 28, 2021 2:43 pm

Re: Indesign - Update links

Post by Dalgas »

@freddyyp - The script works :) Simple, and perfect for my setup....

Have a nice day :)
Post Reply