Article View: adobe.scripting.indesign
Article #16421[VB] Hyperlinks and images
From: David Ames
Date: Fri, 12 Sep 2003 05:56
Date: Fri, 12 Sep 2003 05:56
31 lines
2849 bytes
2849 bytes
Hey all,
This problem has me tearing my hair out!
I want to add some external hyperlink to images and textframes in an ID doc, and export the doc to HTML so that the hyperlinks work.
I can get this working for TextFrames, but for image frames with the same code, it does not work. (ie, the HTML has the hyperlinks for the textframes, but not the image boxes).
The hyperlinks are added to the hyperlinks window in ID, and clicking on a hyperlink in the window that has it's source item set to a TextFrame results in the text frame being selected, but clicking on the image hyperlink does not result in anything being selected.
Creating the hyperlink in ID via the UI is perfect (both in terms of selecting and exporting the link), it just seems to be the method of attaching the hyperlink to the page item source via script that's a problem?
Help please : )
--CODE EXAMPLE HERE--
For lCurrentPageItem = 1 To m_idDocument.AllPageItems.Count
If TypeName(m_idDocument.AllPageItems(lCurrentPageItem)) = "TextFrame" Then
Set idTextFrame = m_idDocument.AllPageItems(lCurrentPageItem)
Set idHyperLinkURLDestination = m_idDocument.HyperlinkURLDestinations.Add
idHyperLinkURLDestination.DestinationURL = "http://test.com"
Set idHyperLinkPageItemSource = m_idDocument.HyperlinkPageItemSources.Add(idTextFrame)
Set idHyperLink = m_idDocument.Hyperlinks.Add(idHyperLinkPageItemSource, idHyperLinkURLDestination)
End If
If TypeName(m_idDocument.AllPageItems(lCurrentPageItem)) = "Image" Then
Set idImage = m_idDocument.AllPageItems(lCurrentPageItem)
Set idHyperLinkURLDestination = m_idDocument.HyperlinkURLDestinations.Add
idHyperLinkURLDestination.DestinationURL = "http://test.com"
Set idHyperLinkPageItemSource = m_idDocument.HyperlinkPageItemSources.Add(idImage)
Set idHyperLink = m_idDocument.Hyperlinks.Add(idHyperLinkPageItemSource, idHyperLinkURLDestination)
End If
--CODE EXAMPLE HERE--
Technical Details
Message-ID:
<2ccd684c.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,948f7fcb7fcde624,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-09-11 23:08:05 PST From: "David Ames" <davida@in-site.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [VB] Hyperlinks and images Message-ID: <2ccd684c.-1@webx.la2eafNXanI> Date: Thu, 11 Sep 2003 22:56:55 -0700 Lines: 50 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit