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

Add a hyperlink to another document? CS4

People's Champ ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

Hi,

How would one add a hyperlink to a document that refers to another document?

The basic is:

myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkTextDestination);

How do I get "myHyperlinkTextDestination" if it exists in another, unopened InDesign document?

I suppose I could open the document, get the Hyperlink destination, and then close it again, but in the UI this is not necessary (you simply browse to the required file and can then choose from a list of hyperlink destinations in that file). So how is this scripted?

Thanks,

Ariel

TOPICS
Scripting

Views

1.6K

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
community guidelines
People's Champ ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

Next, I tried this:

I opened the document and got it's HyperlinkTextDestination.

Then I used it when adding the hyperlink to the main document:

app.activeDocument.hyperlinks.add(mySource, myDestination) //myDestination is a hyperlink destination in another document.

And I get the following error message:

Cannot set this property to an object in another document.

So I'm clearly on a wild goose chase here.

But obviously this is possible since it is doable in the UI.

Any and all help appreciated!

Ariel

Votes

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
community guidelines
Community Expert ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

Hi Arïel,

Have you looked at HyperlinkExternalPageDestination?

"A hyperlink destination that is a page in a document other than the document that contains the hyperlink source."

(I have no idea how to use it, but one of its properties is "documentPath" -- the 'other' document. Sounds good, dunnit?)

Votes

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
community guidelines
People's Champ ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

Hi Jongware,

I did notice that, but:

a. I have no idea how to use it either; and more importantly:

b. I have to use textDestinations and not page destinations.

Look, I'll explain why I need this stuff, and maybe you can tell me that

I've got it all wrong:

I'm creating an eBook of the Book of Psalms. The publisher wants a table

of contents as a page (apart from the one that Adobe Digital Editions

adds as a toolbar on the left).

So I've got an InDesign book with 150 documents (one per psalm so it

starts on a new page. InDesign CS4 here).

So I've added a document with a list of the chapters. I was able to

script a hyperlinkTextDestination at the beginning of each chapter

(which saved me doing that 150 times).

Now I want to script a textSource for each line in the TOC that will

link up with the text destination

Ideas suggestions etc. welcome, but especially I would like to know how

to script a text source that points to a text destination in an external

document.

Thanks,

Ariel

Votes

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
community guidelines
People's Champ ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

Well, having Googled "hyperlink TextDestination external" I finally came across this

thread:

http://forums.adobe.com/message/2474180

Looks like he found a solution very similar to what I posted in the second message in this thread. I'm going to give it a shot.

Ariel

Votes

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
community guidelines
LEGEND ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

You can create a hyperlink with a destination in another document, but I believe it must be open. You can open it with no window if you'd like.

The hyperlink must be added to the document with the source.

Harbs

Votes

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
community guidelines
People's Champ ,
Dec 20, 2010 Dec 20, 2010

Copy link to clipboard

Copied

LATEST

Hi Harbs,

Thanks. Yup, you're right, the external document must be temporarily

opened. The thread I linked to in my previous post shows exactly how

this should be done, and it finally worked for me.

Phew! That saved 150 tedious repetitions (well, actually 90. I had

already started doing the first 60 manually!)

Ariel

Votes

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
community guidelines