1 Reply Latest reply on Jun 26, 2008 8:27 AM by Peter Kahrel

    exportFile

    sotospeak (carlo bazzo)
      for testing purposes I would like to export in a text file the results of my grep search. Is this possible?

      Tried something like this to have just the first found word exported:
      function findtextgrep() {
      app.findGrepPreferences = NothingEnum.nothing;
      app.changeGrepPreferences = NothingEnum.nothing;
      app.findChangeGrepOptions.includeFootnotes = false;
      app.findChangeGrepOptions.includeHiddenLayers = false;
      app.findChangeGrepOptions.includeLockedLayersForFind = false;
      app.findChangeGrepOptions.includeLockedStoriesForFind = false;
      app.findChangeGrepOptions.includeMasterPages = false;
      app.findGrepPreferences.findWhat = "(\\[)(.*)(\\])";
      var myFoundItems = app.documents.item(0).findGrep();
      alert("Found " + myFoundItems.length + " instances of the search string.");
      alert("First occurrance: "+myFoundItems[0].contents);
      myword=myFoundItems[0];
      alert(myword);
      myword.exportFile(ExportFormat.textType, File("/c/myTestDocument.txt"), true);
      }

      I had the file created but it is empty. Thank you

      carlo