Highlighted

Story Splitter that won't unthread ALL of my text boxes, just two.

Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

I'm working with a long document that contains five chapters with a lot of illustrations so I have a lot of threaded text boxes within each chapter. I want to unlink/break the thread between chapters so that when we go back to edit, changes in chapter 1 only effect the pages in that chapter and not all the preceeding chapters. All of the scripts I've found unthread ALL of the text boxes and I only want to unthread/break the thread between two text boxes leaving the preceding text boxes threaded. (The graphic attached shows what I'm trying to do).

Can anyone help? I've found a lot posts about this and I can't beleive InDesign hasn't developed a script for this. InDesign's splitstory or breakstory scripts unthread ALL of the text boxes, which I don't want.  I've read about storysplitter.jsx which may work but I can't find code that works. The code is offered in several places and have tried each of them but they all come up with errors and thus, don't work. (I'm not knowlegeable with code at all so I would need one that doesn't require editing, if that's the answer)

This is what I want:

To break only the ONE link/thread between the last text box in chapter 1 and the first text box in chapter 2. Then, continue with Chapter 2 (unlinked to Chapter 1) with threaded text boxes, and repeat at the end of Chapter 2 to start clean with Chapter 3, and so on for all the other chapters.

I hope InDesign includes one soon. Thanks in advance 🙂

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi waruppert,

if you have InDesign 2020 version 15.0.3 installed you have direct access to:

BreakTextThread.jsx by Ariel Walden in the Community section of your Scripts panel.

 

All details:

https://www.id-extras.com/break-text-thread/

 

Regards,
Uwe Laubender

( ACP )

Topics

Scripting

Views

665

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Story Splitter that won't unthread ALL of my text boxes, just two.

Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

I'm working with a long document that contains five chapters with a lot of illustrations so I have a lot of threaded text boxes within each chapter. I want to unlink/break the thread between chapters so that when we go back to edit, changes in chapter 1 only effect the pages in that chapter and not all the preceeding chapters. All of the scripts I've found unthread ALL of the text boxes and I only want to unthread/break the thread between two text boxes leaving the preceding text boxes threaded. (The graphic attached shows what I'm trying to do).

Can anyone help? I've found a lot posts about this and I can't beleive InDesign hasn't developed a script for this. InDesign's splitstory or breakstory scripts unthread ALL of the text boxes, which I don't want.  I've read about storysplitter.jsx which may work but I can't find code that works. The code is offered in several places and have tried each of them but they all come up with errors and thus, don't work. (I'm not knowlegeable with code at all so I would need one that doesn't require editing, if that's the answer)

This is what I want:

To break only the ONE link/thread between the last text box in chapter 1 and the first text box in chapter 2. Then, continue with Chapter 2 (unlinked to Chapter 1) with threaded text boxes, and repeat at the end of Chapter 2 to start clean with Chapter 3, and so on for all the other chapters.

I hope InDesign includes one soon. Thanks in advance 🙂

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi waruppert,

if you have InDesign 2020 version 15.0.3 installed you have direct access to:

BreakTextThread.jsx by Ariel Walden in the Community section of your Scripts panel.

 

All details:

https://www.id-extras.com/break-text-thread/

 

Regards,
Uwe Laubender

( ACP )

Topics

Scripting

Views

666

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 02, 2020 0
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

RE: "I can't beleive InDesign hasn't developed a script for this. InDesign's splitstory or breakstory scripts unthread ALL of the text boxes, which I don't want."

Why didn't you build the chapters into separate documents and put them together ito a book file? You can still do that but it will take a little time, but you can probably do it in 30 minutes or so. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 0
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

I have modified the splitstory script for what you want, try the following. Make sure you try it on a copy of your document

main();
function main(){
	//Make certain that user interaction (display of dialogs, etc.) is turned on.
	app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
	if(app.documents.length != 0){
		if(app.selection.length != 0){
			//Get the first item in the selection.
			var mySelection = app.selection[0];
			//Process the selection. If text or a text frame is 
			//selected, do something; otherwise, do nothing.
			switch(mySelection.constructor.name){
				case "Text":
				case "InsertionPoint":
				case "Character":
				case "Word":
				case "Line":
				case "TextStyleRange":
				case "Paragraph":
				case "TextColumn":
				case "TextFrame":
					//If the text frame is the only text frame in the story, do nothing.
					if(mySelection.parentStory.textContainers.length > 1){
						//Splitting the story is a two-step process: first, duplicate
						//the text frames, second, delete the original text frames.
						mySplitStory(mySelection.parentStory);
						myRemoveFrames(mySelection.parentStory);
					}
					else{
						alert("Please select a story containing more than one text frame and try again.");
					}
					break;
				default:
					alert("Please select some text or a text frame and try again.");
			}
		}
		else{
			alert("Please select some text or a text frame and try again.");
		}
	}
	else{
		alert("Please open a document and try again.");
	}
}
function mySplitStory(myStory){
	var myTextFrame;
	//Duplicate each text frame in the story.
	var a, b
	for(var myCounter = myStory.textContainers.length-1; myCounter > 0;){
		myTextFrame = myStory.textContainers[myCounter];
		myTextFrame1 = myStory.textContainers[myCounter - 1];
		var a = myTextFrame.duplicate();
		var b = myTextFrame1.duplicate();
		if(a.parentPage.name == b.parentPage.name) a.previousTextFrame = b
		myCounter -=2
	}
}
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();
	}
}

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 0
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

thank you, I copied it into TextEdit and saved it as a jsx file, which I
moved to the "user" scripts folder but when I try to use it on my text
boxes, I get this error


Wendy

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 0
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

What's the error. You need to make a selection of a texframe of the thread and then run the script

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 0
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

Hi waruppert,

if you have InDesign 2020 version 15.0.3 installed you have direct access to:

BreakTextThread.jsx by Ariel Walden in the Community section of your Scripts panel.

 

All details:

https://www.id-extras.com/break-text-thread/

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 2
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

that's great news. I'm running 15.0.2 but have CC so it should update. I'll check that out. thanks so much

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 0
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

I just updated and that worked wonderfully!!! Thank you so much.

Issue resolved.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2020 1
Adobe Community Professional ,
Jun 08, 2020

Copy link to clipboard

Copied

Hi Wendy,

thanks for reporting that Ariel's script is working for you as expected.

 

However, we still do not know why Manan's script is not working.

Maybe you attached a screenshot with the error message when answering by mail.

But as far as I know, a mail answer will not ( can not ) contain any visible attachment here in the forum.

 

Would you please be so kind to go to this thread in the forum and insert your screenshot with the error message.

Or better: Also add the error message in written text.

 

Thanks a lot! This will be very helpful.

 

Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 08, 2020 0
Community Beginner ,
Jun 09, 2020

Copy link to clipboard

Copied

Sure. The error message I got was this. Hopefully I've uploaded this screenshot correctly that you can see it now.

If not, let me know and I'll retype it.

 

Screen Shot 2020-06-02 at 1.35.08 PM.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 0
Adobe Community Professional ,
Jun 09, 2020

Copy link to clipboard

Copied

Hi Wendy,

 

Have a look at a blog on how to use the scripts that you find on the internet

https://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-po...

 

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 0
Adobe Community Professional ,
Jun 09, 2020

Copy link to clipboard

Copied

Hi Wendy,

thanks for the screenshot.

 

From that I can see that the script code was not properly saved as text-only file. It was saved with text formatting. Therefore the rtf statement at the beginning of the message. rtf > Rich Text Format.

 

If you save ExtendScript script code make sure that the file is text-only and not formatted.

 

Thanks,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 1