What should I use instead of ".destinationPage"?
A page, not a number. A number could mean anything, whereas a page is .. a page
app.activeDocument.hyperlinks.itemByName("Hyperlink 1").destinationPage = app.activeDocument.pages;
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;
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.
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:
...doesnt remove the group. If you, or anyone else who has the time, could help me here I would greatly appreciate it.
1 person found this helpful
Never mind! This worked: