-
1. Re: [JS][CS6] Change hyperlink page destination
[Jongware] Feb 19, 2013 6:54 AM (in response to PrntScr)PrntScr wrote:
What should I use instead of ".destinationPage"?
A page, not a number. A number could mean anything, whereas a page is .. a page
But this
app.activeDocument.hyperlinks.itemByName("Hyperlink 1").destinationPage = app.activeDocument.pages[0];
does not work, because you forgot a level. A hyperlink has a destination, not a destination page, because hyperlinks can point to various items -- see http://jongware.mit.edu/idcs5/pc_Hyperlink.html.
So, use this
app.activeDocument.hyperlinks.itemByName("Hyperlink 1").destination.destinationPage = app.activeDocument.pages[0];
and it will work, but only if the destination type already is a "HyperlinkPageDestination". If it's not, you have to add it first to your document's list of hyperlinkPageDestinations -- which is returned as a new object -- and then assign this object to the 'destination' property.
-
2. Re: [JS][CS6] Change hyperlink page destination
PrntScr Feb 19, 2013 7:23 AM (in response to [Jongware])Thanks Jongware! Once again to the rescue.
Now I'm attempting to 'climb' up the object model, to reference the source of the hyperlink. It is a group (of a rectangle and a polygon) and has a name "BACK". I tried to extrapolate from the above, but my assumptions where incorrect:
app.activeDocument.hyperlinks.itemByName("Hyperlink 1").source.hyperlinkPageItemSource.remove();
...doesnt remove the group. If you, or anyone else who has the time, could help me here I would greatly appreciate it.
-
3. Re: [JS][CS6] Change hyperlink page destination
PrntScr Feb 19, 2013 7:34 AM (in response to PrntScr)Never mind! This worked:
app.activeDocument.hyperlinks.itemByName("Hyperlink 1").source.sourcePageItem.remove()

