Skip to main content
Known Participant
June 17, 2009
Answered

Cut/paste text from anchored text box?

  • June 17, 2009
  • 2 replies
  • 678 views

CS4, Mac G5, Leopard.

I've recently been investigating scripting in InDesign and have a problem to solve that is beyond my, basic, understanding.

I have used Rorohiko 'Lightning Brain Text Exporter' to extract text (rtf) from a book.

The text contains countless anchored text frames. I would like to be able to select all the text within the anchored text frame, cut it, and paste it back into the document where the anchored item is referenced and then delete the (now empty) anchored text frame.

Any help would be gratefully accepted

Thanks Steve

This topic has been closed for replies.
Correct answer interesting_Flower157F

A complete javascript (from the previous forum post):

var myDocument = app.activeDocument;

inlines(myDocument);

function inlines (doc) {
    var st = doc.stories;
    for (var i = doc.stories.length-1; i > -1; i--) {
        while (st.textFrames.length > 0 ) {
            var ix = st.textFrames[-1].parent.index;
            st.textFrames[-1].texts[0].move(LocationOptions.after, st.insertionPoints[ix]);
            st.textFrames[-1].locked = false;
            st.textFrames[-1].remove();
        }
    }
}

2 replies

interesting_Flower157F
Inspiring
June 17, 2009

A complete javascript (from the previous forum post):

var myDocument = app.activeDocument;

inlines(myDocument);

function inlines (doc) {
    var st = doc.stories;
    for (var i = doc.stories.length-1; i > -1; i--) {
        while (st.textFrames.length > 0 ) {
            var ix = st.textFrames[-1].parent.index;
            st.textFrames[-1].texts[0].move(LocationOptions.after, st.insertionPoints[ix]);
            st.textFrames[-1].locked = false;
            st.textFrames[-1].remove();
        }
    }
}

seb400Author
Known Participant
June 17, 2009

Thomas

thanks very much for that, works a treat!

Steve

interesting_Flower157F
Inspiring
June 17, 2009

I Think this post will help you:

http://forums.adobe.com/message/1112954#1112954

--

Thomas B. Nielsen

http://www.nobrainer.dk