🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #605

[JS, CS3] Setting Page Destination on Button

#605
From: Stefan_Huwiler
Date: Tue, 10 Mar 2009 08:33
34 lines
2484 bytes
Hi

I unsuccessfull try to set the a Page Destination on a Button.
The script loops through the Document and picks certain textframes, which contain the page.name as text. inside the loop I do this:

// START LOOP

// Getting the Content of Textframe -> this is the destination Page Number
myDestinationPage = myDocument.pages.itemByName ( myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].contents );

// Creating a HyperlinkPageDestinationObject
myHyperlinkPageDestination = myDocument.hyperlinkPageDestinations.add( myDestinationPage );

// Creating a new Button over a certain area on the actual Page - setting visibility off							
myButton = myDocument.pages[ pageIterator ].buttons.add({visibilityInPdf:1181247844,																							geometricBounds:[ myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 0 ],12,myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 2 ],	myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 3 ]]});

// Creating an hyperlinkPageItemSource = the Actual Button	myHyperlinkPageItemSource			= myDocument.hyperlinkPageItemSources.add( myButton );

// Creating an Hyperlink
myHyperlink = myDocument.hyperlinks.add( myHyperlinkPageItemSource, myHyperlinkPageDestination );

//The Destination shall be a Ceratin Page so I add a gotoAnchorBehavior
myGotoAnchorBehavior = myButton.gotoAnchorBehaviors.add();

// Now I try to set the Anchor Target. I think that's not working...
myGotoAnchorBehavior.anchorItem	=myHyperlink;

// END LOOP

The Buttons are there, the Destinations as well, but the ceratin button has not the desired Page as destination. Does someone have a hint on this topic?

Thanks and greets

Stefan
Technical Details
Message-ID: <59b82b5a.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns11feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,e0951e54ba5d6c59,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Stefan_Huwiler@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns11feed!worldnet.att.net!208.48.142.85!newsfeed.news2me.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: [JS, CS3]  Setting Page Destination on Button
Message-ID: <59b82b5a.-1@webcrossing.la2eafNXanI>
Date: Tue, 10 Mar 2009 01:33:52 -0700
Lines: 33
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Original-Lines: 48