2 Replies Latest reply on Dec 5, 2015 5:55 AM by Christopher Pickering

    create inline anchored text frame

    Christopher Pickering Level 1

      Hello!

       

      I am trying to create an anchored text frame from the results of a search. If I create the anchored frame from a selection it works no problem, but when I do it from the results of a grep I get the "Text cannot be moved to its current location" error....Do you have any ideas how to resolve that?

       

      As a side question... when I create an object style through script the text frame always has a border.. why is that? (I created the style with another script)

       

      doc = app.activeDocument;
      app.findGrepPreferences = app.changeGrepPreferences = null;  
      app.findGrepPreferences.findWhat = "~6";  
      var myFinds = doc.findGrep();  
      for (i = myFinds.length; i > 0; i--){
      var os = doc.objectStyles.item ("Section");
      var new_note = myFinds[0].insertionPoints[0].textFrames.add ({appliedObjectStyle: os, label: 'Section'});
      var n = myFinds[0].texts[0].move (LocationOptions.atBeginning, new_note.insertionPoints[0]);
      n.applyParagraphStyle (os.appliedParagraphStyle, false)
      new_note.fit (FitOptions.frameToContent);
      }
      

       

      Thank you!
      Christopher

      test.png