2 Replies Latest reply on Jan 15, 2010 6:05 AM by Murral

    [CS4, JS] Text frame geometricBounds undefined




      I'm searching through all the paragraphs in a document for paragraphs with a particular paragraph style. When it's found, the script takes the geometric bounds of the parent text frame and uses them later. However, it doesn't work in some documents because the geometric bounds of text frames are undefined and cause an error. The error causing documents were originally PageMaker documents than have been opened through InDesign as saved as .indd. Documents created in InDesign run the script fine.


      Anyway, here's the part of the script that's causing problems (I've tried iterating backwards and forwards, but to no avail):


      myDocStories = app.activeDocument.stories


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

      for (var j = myDocStories[i].paragraphs.length - 1; i >= 0; i--){
      // Check each paragraph in active document for the chosen find paragraph or object style
      if(myDocStories[i].paragraphs[j].appliedParagraphStyle.name == myFindParVal){
      var myBounds = "";
      myBounds = myDocStories[i].paragraphs[j].parentTextFrames[0].geometricBounds;





      The weird thing is, if I select a paragraph that's found by the script and run app.selection[0].parentTextFrames[0].geometricBounds in the console...it tells me the bounds of the text frame.


      I have literally no idea why it's doing this, but I suspect it's something to do with the fact that they used to be PageMaker files...