Skip to main content
Known Participant
February 27, 2023
Answered

Can I separate all linked text frames from each other in the InDesign document?

  • February 27, 2023
  • 4 replies
  • 1780 views

Split 3.0 is working great for me in a selected story. Can I separate all linked text frames from each other in the InDesign document? Thank you.

This topic has been closed for replies.
Correct answer m1b

Hi @uniq1, I've used the functions from SplitStory.jsx sample script to split all stories in active document. - Mark

Thanks @Eugene Tyson, for pointing me to the sample script!

 

/**
 * Split all stories in active document;
 */
function main() {

	var doc = app.activeDocument,
		stories = doc.stories,
		counter = 0;

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

		var story = stories[i];

		if (story.textContainers.length == 1)
			continue;

		//Splitting the story is a two-step process: first, duplicate
		//the text frames, second, delete the original text frames.
		mySplitStory(story);
		myRemoveFrames(story);

		counter++;

	}

	alert('Split ' + counter + ' stories.');

};

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Split All Stories');


// from the sample script: SplitStory.jsx
function mySplitStory(myStory) {
	var myTextFrame;
	//Duplicate each text frame in the story.
	for (var myCounter = myStory.textContainers.length - 1; myCounter >= 0; myCounter--) {
		myTextFrame = myStory.textContainers[myCounter];
		myTextFrame.duplicate();
	}
};

// from the sample script: SplitStory.jsx
function myRemoveFrames(myStory) {
	//Remove each text frame in the story. Iterate backwards to avoid invalid references.
	for (var myCounter = myStory.textContainers.length - 1; myCounter >= 0; myCounter--) {
		myStory.textContainers[myCounter].remove();
	}
};

 

4 replies

Inspiring
March 1, 2023

I don't know why using the "1 Correct Answer" script would be necessary, at least for InD 2023 and maybe earlier. As mentioned, just use the script already installed in the Scripts panel, in the Community folder called "BreakTextThread.jsx" Works great, and with options.

m1b
Community Expert
Community Expert
March 2, 2023

@CMcDowall, the OP asked for a script to break every threaded story in the document. The breakTextThread.jsx script performs on one story at a time. - Mark

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
February 28, 2023

Hi @uniq1, I've used the functions from SplitStory.jsx sample script to split all stories in active document. - Mark

Thanks @Eugene Tyson, for pointing me to the sample script!

 

/**
 * Split all stories in active document;
 */
function main() {

	var doc = app.activeDocument,
		stories = doc.stories,
		counter = 0;

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

		var story = stories[i];

		if (story.textContainers.length == 1)
			continue;

		//Splitting the story is a two-step process: first, duplicate
		//the text frames, second, delete the original text frames.
		mySplitStory(story);
		myRemoveFrames(story);

		counter++;

	}

	alert('Split ' + counter + ' stories.');

};

app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Split All Stories');


// from the sample script: SplitStory.jsx
function mySplitStory(myStory) {
	var myTextFrame;
	//Duplicate each text frame in the story.
	for (var myCounter = myStory.textContainers.length - 1; myCounter >= 0; myCounter--) {
		myTextFrame = myStory.textContainers[myCounter];
		myTextFrame.duplicate();
	}
};

// from the sample script: SplitStory.jsx
function myRemoveFrames(myStory) {
	//Remove each text frame in the story. Iterate backwards to avoid invalid references.
	for (var myCounter = myStory.textContainers.length - 1; myCounter >= 0; myCounter--) {
		myStory.textContainers[myCounter].remove();
	}
};

 

uniq1Author
Known Participant
March 1, 2023

split all the stories in the active document. Thank you very much @m1b.

(Note: It split 150 stories of 2700 pages in 2 minutes.)

m1b
Community Expert
Community Expert
March 1, 2023

You're welcome! 🙂

Community Expert
February 28, 2023

There's one in the InDesign script folder - I don't have Indesign here on this computer - but I think it's in the sample scripts called Break Frames or Split or something.

 

m1b
Community Expert
Community Expert
February 28, 2023

Hi @uniq1, the answer is yes, but we'd need to see the code for Split 3.0 to do the adjustment. Can you post a link to that script, or post the code itself? Otherwise, we'll have to start from scratch. Or someone may have a script already?

uniq1Author
Known Participant
February 28, 2023

Hi @m1b 
Hello, the built-in splitStory script in InDesign only separates selected text frames from each other. I want to break the connections of all linked text frames in the document. Thank you

Community Expert
February 28, 2023

There are 2 in the InDesign scripts folder. I've definitely used it before to split all text frames.