Skip to main content
Known Participant
February 5, 2010
Answered

try...catch missing links.....

  • February 5, 2010
  • 3 replies
  • 1093 views

I've got an indd with missing links and am trying the following to catch the error and report back to user. Unfortunately it is failing...

Can anyone cast any light on why the following is not working please:

try

{

app.activeDocument.links.everyItem().unlink();

}

catch ( thiserror )

{

alert(Error.description)

};

Cheers

This topic has been closed for replies.
Correct answer Peter Kahrel

Try

try

{

app.activeDocument.links.everyItem().unlink();

}

catch ( thiserror )

{

alert(thiserror.message);

exit ()

};

Peter

3 replies

Participant
April 5, 2023

This is unbelievable. About a hundred years age in computer time, I worked at the Rockford Register Star in 1995 and we used Multi-Ad Creater. Several people may have worked on an ad so missing art was a common problem.

If photos or art or whatever was missing, you’d click “Find mising graphics” to find all missing art, photos, whatever would be found. It took about a minute or less. This was almost 30 THIRTY YEARS AGO and InDesign still can’t perform thie SIMPLE and NEEDED function. WHAT A JOKE.

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
February 5, 2010

Try

try

{

app.activeDocument.links.everyItem().unlink();

}

catch ( thiserror )

{

alert(thiserror.message);

exit ()

};

Peter

penyfaiAuthor
Known Participant
February 5, 2010

Hi Peter

Tried that too...again the alert doesn't show. I'm using CS3 and where I know the line

       app.activeDocument.links.everyItem().unlink();

works if the link is available and using the embed menu item from Links throws an error, I still can't get this error back to the JS.

Just wondering if it's better to try an 'if' instead....?

Andrew

ramkumar_vp
Inspiring
February 5, 2010

Hi,


Don't use unlink. Try to check this with update() otherwise "linkstatus"


It will work...


Regards,

Ramkumar .P

penyfaiAuthor
Known Participant
February 5, 2010

Hi Ramkumar

The thing is that I do want to embed the linked files.

When I run the embed command in InDesign it will error, therefore I should be able to catch the error description and throw it back to the user.

The script should then exit, allowing the user to put the problem right.

It did report the error once, but has since stopped producing the message for that doc on subsequent runs of the js.

Am I missing something?

Cheers

Andrew