Article View: adobe.scripting.indesign
Article #16200Re: Newbie question: scripting hyperlink generation with AS
From: Dianna_Bearce
Date: Thu, 09 Oct 2003 22:28
Date: Thu, 09 Oct 2003 22:28
27 lines
2232 bytes
2232 bytes
Okay, here's what I have so far. The script is dependent on you highlighting a page number in the index before you run it. I am doing this in a book with several documents, all open at the time I run the script.
tell application "InDesign 2.0.2"
activate
set myDoc to active document
tell myDoc
set pageNumber to selection
end tell
repeat with x from 1 to the number of documents
try
set myDestination to text frame 1 of page pageNumber of document x
end try
end repeat
tell myDoc
delete hyperlink of selection
set clickableHyperlink to make hyperlink text source with properties {source text:selection}
end tell
end tell
At first I didn't have the "delete hyperlink" line, but then I got an error saying my selection already had a hyperlink. But when I add the delete line, I get an error saying that it "can't get" the hyperlink.
I know that ID has some issues with indexing (see Index hyperlinks lost in PDF <http://www.adobeforums.com/cgi-bin/webx?128@@.2ccd4fc6>. I am writing this script to make the hyperlinking faster (although it ticks me off that I have to do it at all because InDesign's feature should work . . . but I know I can use it in other areas as well.)
I would appreciate any tips to get past this road block and also would gladly accept any criticisms or pointers on any of my script as this is my first one.
Thanks in advance for any help,
Dianna Bearce
Technical Details
Message-ID:
<2ccdccfc.2@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!peer2.news.opaltelecom.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccdccfc.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,158874a13e0c525a X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-10-09 15:38:45 PST From: Dianna_Bearce@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!peer2.news.opaltelecom.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Newbie question: scripting hyperlink generation with AS Message-ID: <2ccdccfc.2@webx.la2eafNXanI> Date: Thu, 9 Oct 2003 15:28:28 -0700 References: <2ccdccfc.-1@webx.la2eafNXanI> Lines: 38 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit