2 Replies Latest reply on Apr 27, 2017 6:52 AM by jimelevens

    hyperlinkPageItemSources.add issues


      Hi all, I need help, a little new to inDesign scripting.

      I have created a script that adds 6 - 7 hyperlinked rectangles per pages in a document that can vary from 5 - 250 pages, using loops. Everything works fine apart from the hyperlinks, all the hyperlinks go to the same page because the rectangle object is always called myButt. I have tried using the id to add the hyperlink but this is not compatible with "hyperlinkPageItemSources", I would like to create a variable name for myButt, but can't figure it out.

      This is the code creating the rectangle:


      var  myButt = myDoc.pages[i].rectangles.add({
      geometricBounds: [y1[b] , x1[b], y2[b], x2[b]],
      topLeftCornerOption: CornerOptions.ROUNDED_CORNER,
      topLeftCornerRadius: "6px",
      bottomLeftCornerOption: CornerOptions.ROUNDED_CORNER,
      bottomLeftCornerRadius: "6px",
      topRightCornerOption: CornerOptions.ROUNDED_CORNER,
      topRightCornerRadius: "6px",
      bottomRightCornerOption: CornerOptions.ROUNDED_CORNER,
      bottomRightCornerRadius: "6px",


      This is the code to add the hyperlink:

      var myHyperPage = myDoc.hyperlinkPageDestinations.add(myDoc.pages.item(Hlink));
      var myHyperSource = myDoc.hyperlinkPageItemSources.add(myButt);
      var myHyper = myDoc.hyperlinks.add(myHyperSource,myHyperPage);


      Please help, thanks in advance.