JS CS3 : Hyperlinks.add(y,z) always recreates the same object :-(
Hi,
I am trying to create hyperlinks from an index. The command works fine except that doc.hyperlinks.add(source,destination) always rewrites the former one. They don't stack and I need them to do this way.
Could you help ?
I write this function :
function hyperlien(src,dest)
{
app.findTextPreferences.findWhat=src.contents;
//var txtsrc = doc.hyperlinkTextSources.add(src);
var txtsrc = doc.hyperlinkTextSources.add(doc.pageItems.item("index").findText()[0]);
var pgdest = doc.hyperlinkPageDestinations.add();
pgdest.destinationPage = dest;
with(doc.hyperlinks.add (txtsrc,pgdest))
{
name = src.contents;
visible = false;
}
app.select(NothingEnum.nothing, undefined);
}
and calls it this way :
hyperlien(app.selection[0],myPage);
according app.selection[0] is text, myPage is defined on top as:
var sel=app.selection[0];
var myFrame = app.selection[0].parentTextFrames[0];
var myPage = myFrame.parent;
the text is on a page but I try to apply the hyperlinks to the same text in the index. Hence I set my source as doc.pageItems.item("index").findText()[0]
Hope you can help.
Thanks Loic