1 Reply Latest reply on Jan 31, 2015 12:02 AM by Peter Spier

    How to use data merge with hyperlinks?

    nicks48943206

      There are plenty of post out there about this but in all of my searches I have yet to find a solution which works.

       

      This is my current script:

      <<Start Script>>

      app.findGrepPreferences = app.changeGrepPreferences = null;

      doc = app.activeDocument;

      app.findGrepPreferences.findWhat = "(?<=11).*?(?=11)";

      var lnks = doc.findGrep();

      app.findGrepPreferences.findWhat = "(?<=00).*?(?=00)";

      var txts = doc.findGrep();

       

      for (var i = 0; i < lnks.length; i++) {

        var urld = doc.hyperlinkURLDestinations.add(lnks[i].contents);

        doc.hyperlinks.add(doc.hyperlinkTextSources.add(txts[i]), urld);

      }

       

      alert('Processed '+txts.length+' hyperlinks');

      <<End Script>>

       

      I receive an error "the object is already being used by another hyperlink."

       

      Thank you.