0 Replies Latest reply on Aug 14, 2015 11:47 AM by martinpublishingservices

    Prompt User for Find and Replace Fields (change word into clickable hyperlink)

    martinpublishingservices

      I have a script that lets me change out the variables manually.  How do I make it so that it prompts me from within InDesign?



      Example: I want to find all instances of the word "coconut" and make the word "coconut" a clickable link using "http://mylink.com".


      app.changeGrepPreferences = NothingEnum.nothing;

      app.findGrepPreferences = NothingEnum.nothing;

      app.findGrepPreferences.findWhat = "SEARCH";

      var erg = app.activeDocument.findGrep ();     

       

      for (var i = erg.length - 1; i >= 0; i--) {

          var _hlinkSource = app.activeDocument.hyperlinkTextSources.add(erg[i]);

          var _destination = app.activeDocument.hyperlinkURLDestinations.add("http://www.google.de");

          app.activeDocument.hyperlinks.add(_hlinkSource, _destination);

      }


      TIA