Create text frame from selected text in indesign

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Create text frame from selected text in indesign

Viewing 2 reply threads
  • Author
    Posts
    • #81736
      Mehmet Mese
      Member

      Hi;

      I’m working with long documents in indesign. Create text frame from selected text in indesign?
      1. I select and copy text.
      2. paste into pasteboard text.
      3. Cut text frame and paste into the text field again.

      Is there a script that will do automatic?
      Thanks in advance for any assistance you can offer.

    • #81739
      Peter Kahrel
      Participant

      What do you mean by ‘paste into the text field again’? That the frame becomes an inline? If what you select is on a single line, then the script below would do it. Select some text, all on one line, and run the script.

      (function(){
        var width = app.selection[0].endHorizontalOffset - app.selection[0].horizontalOffset;
        var frame = app.selection[0].textFrames.add();
        app.selection[0].move (LocationOptions.AFTER, frame.insertionPoints[0]);
        var gb = frame.geometricBounds;
        gb[3] = gb[1]+width
        frame.geometricBounds = gb;
      }());

      Peter

    • #81837
      Mehmet Mese
      Member

      Thanks Peter, works great. text overflow in text frames are created. already resolved the problem with the object style. Thanks a lot for your reply and valuable information.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>