Mobile app version of vmapp.org
Login or Join
Jessie844

: InDesign CC javascript and hyperlinks: how do you determine what kind of hyperlink you're dealing with? I am fairly new to scripting, and I'm developing a script that extracts destination URLs

@Jessie844

Posted in: #AdobeIndesign #Javascript

I am fairly new to scripting, and I'm developing a script that extracts destination URLs from all the hyperlinks in a document. Sure enough, there are some cross-references in these documents that are not HyperlinkURLDestination's, so, naturally, my script is bombing when I try to reference the hyperlink's destinationURL.

In another discussion, I thought I had found exactly what I was looking for:

...
if (app.activeDocument.hyperlinks[k].destination instanceof HyperlinkURLDestination)
...

which, in my case, looks like this:

...
if (doc.hyperlinks[i].destination instanceof HyperlinkURLDestination)
...

Now this is where it bombs, and only when it encounters a hyperlink that is not instanceof HyperlinkURLDestination (after 12 HyperlinkURLDestination's, it's the first instanceof HyperlinkTextDestination).

I am clearly doing something wrong. Does anyone have any experience with this kind of scripting in InDesign CC (2017)? Thanks.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Jessie844

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme