Article View: adobe.scripting.indesign
Article #20623Re: Automating the production of Next Page/Previous Page Hyperlinks
From: Shane Stanley
Date: Sun, 16 Jun 2002 23:46
Date: Sun, 16 Jun 2002 23:46
56 lines
3351 bytes
3351 bytes
in article ef9252e.-1@WebX.aaQKaf7vad4, Duncan Sage wrote:
> I'm looking for some expert advice on how to produce a script that will enable
> me to automate the production of next page and previous page hyperlink buttons
> to go on the bottom of each page of several scientific reports to be exported
> to Acrobat, ie if the viewer is on page 3 there will be one button to take
> them back to page 2 and one to take them on to page 4. The reports vary in
> size (in terms of the number of pages - all 100+) so i was hoping there was a
> way to run the script once (for each report) and have all the hyperlinks
> created as opposed to running it on each page of each report. i'd be extremely
> grateful of any help that anyone can give. duncan
This should get you started:
tell application "InDesign 2.0.1"
tell document 1
tell view preferences
set horizontal measurement units to points
set vertical measurement units to points
end tell
tell document preferences
set theWidth to page width
set theheight to page height
end tell
set fromBoxBounds to {theheight - 24, 0, theheight, theWidth / 3}
set toBoxBounds to {theheight - 24, theWidth * 2 / 3, theheight, theWidth}
set pageCount to count of pages
repeat with i from 1 to pageCount
if i > 1 then
set backFrame to make text frame at page i with properties {visible
bounds:fromBoxBounds, contents:("To page " & (i - 1))}
set backSource to make hyperlink page item source with properties
{source page item:backFrame}
set backDest to make hyperlink page destination with properties
{destination page:page (i - 1) of document 1}
make hyperlink with properties {name:("Page " & i & " back"),
source:backSource, destination:backDest, visible:true, border
color:burgundy, width:medium, border style:dashed}
end if
if i < pageCount then
set forwardFrame to make text frame at page i with properties {visible
bounds:toBoxBounds, contents:("To page " & (i + 1))}
set forwardSource to make hyperlink page item source with properties
{source page item:forwardFrame}
set forwardDest to make hyperlink page destination with properties
{destination page:page (i + 1) of document 1}
make hyperlink with properties {name:("Page " & i & " forward"),
source:forwardSource, destination:forwardDest, visible:true, border
color:burgundy, width:medium, border style:dashed}
end if
end repeat
end tell
--
Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<B9335C60.33644%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!feed.textport.net!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<ef9252e.-1@WebX.aaQKaf7vad4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,385d1db3f7850ac X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-06-16 17:07:38 PST From: Shane Stanley <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!feed.textport.net!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Automating the production of Next Page/Previous Page Hyperlinks Message-ID: <B9335C60.33644%sstanley@myriad-com.com.au> Date: Sun, 16 Jun 2002 16:46:31 -0700 References: <ef9252e.-1@WebX.aaQKaf7vad4> Lines: 68 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.3 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit