5 Replies Latest reply on Nov 19, 2011 1:43 AM by csm_phil

    [JS][CS4] - Create outlines of all textFrames in document




      I realize this is an absolutely terrible step to have in your workflow. I am working hard to change it in my organization; however, for now I have to incorporate this function into my script.  I have tried the following snippets without much luck.


      var doc = app.activeDocument;
      for (i=doc.stories.length-1; i>=0; i--){


      This approach has been the most successful but depending on the file I'll get a few different errors:


      1. NoPathCreated - I seem to get this on files that have one textFrame filled with text and a second textFrame that has a table in it.

      2. can't perform function due to bad data - I think I'm getting this error when the file has textFrames within textFrames (which I can rememdy by telling people not to do that) but is there another reason I might get this error?


      I've also tried:


      var doc = app.activeDocument;
      var textFrames = doc.textFrames;
      with(doc) {
      while (textFrames.length !=0){

      This approach seems to loop forever without ever completing the script because INDD gets hung up and eventually has to be force quit.


      Also tried:


      var doc = app.activeDocument;


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

      This approach appears to do nothing but I also don't get any errors.


      Any help is greatly appreciated.