• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

script for removing empty text frames

Community Beginner ,
May 04, 2022 May 04, 2022

Copy link to clipboard

Copied

hi

i have a document that is well over 400 pages and everytime i delete a page; some empty frames appear in the middle of the page.

 

instead of removing them one by one, ive tried a couple of scripts ive found via google, however they are working too well and removing everything- including coloured frames that i need.

 

i have no clue how to write scripts so if someone could give me one that would be amazing.

 

thankyou in advance!

TOPICS
Scripting

Views

591

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
community guidelines
Community Expert ,
May 04, 2022 May 04, 2022

Copy link to clipboard

Copied

Hi @con1499,

What is your definition of an empty frame? And by frame do you mean textframes or retangles, ovals as well?

-Manna

Votes

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
community guidelines
Community Beginner ,
May 04, 2022 May 04, 2022

Copy link to clipboard

Copied

see attached image. the frames in the middle of the page is what needs removing.

the other scripts were also removing the red rectangle frames as well as the grey backgrounds.

Votes

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
community guidelines
Community Expert ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

Try the following code

var pis = app.documents[0].pageItems.everyItem().getElements()
for(var i = 0; i <pis.length; i++){
	var pi = pis[i]
	if(pi.hasOwnProperty("contents"))
	{	if(pi.contents == "" && pi.fillColor.name == "None")
			pi.remove()
	}
	else if(pi.pageItems.length == 0 && pi.fillColor.name == "None")
		pi.remove()
}

-Manan

Votes

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
community guidelines
Community Beginner ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

thankyou

ive realised that there is technically something in the frames i am trying to get rid of. See screenshot below.

i am using easycatalog to create the document, and those green squares indicate that data could be paginated into the frame. is there a way to remove them or not?

 

Votes

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
community guidelines
Community Expert ,
May 05, 2022 May 05, 2022

Copy link to clipboard

Copied

I am not sure what it is untill I see the document myself. Can you share a sample document? Another question is why do you want to delete these frames, looking at there state it does not seem they would be visibile in a pdf or print output.

-Manan

Votes

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
community guidelines
Community Expert ,
Oct 22, 2024 Oct 22, 2024

Copy link to clipboard

Copied

Those are, most likely, either XML markers or easycatalog's some custom tags / markers. 

 

Votes

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
community guidelines
Community Expert ,
Oct 22, 2024 Oct 22, 2024

Copy link to clipboard

Copied

@Manan Joshi

 

Shouldn't be: 

 

pi.fillColor.name == "[None]"

 

 

Votes

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
community guidelines
Participant ,
Oct 22, 2024 Oct 22, 2024

Copy link to clipboard

Copied

Votes

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
community guidelines
Community Expert ,
Oct 22, 2024 Oct 22, 2024

Copy link to clipboard

Copied

LATEST

@con1499

 

If you work on a PC, you could use my ID-Tasker tool. It's not free, but you can create a Task, that will get a list of objects with properties you need - kind of "preflight" - and then you can have another Task that will remove those objects. 

Two separate Tasks, just in case, so you can be sure that you won't remove something important - you can visually inspect pre-selected objects for deletion.  

 

The main advantage of my tool - you don't have to ask anyone to update initial script - you can modify Task(s) at any time, any way you want. 

 

Free version can still be helpful - you can still get list of objects, do this preflight, but you won't be able to remove them in bulk automatically. 

 

And you can do a lot more than this - ID-Tasker can replicate pretty much every mundane click that you can make manually - and not only in InDesign. 

 

Votes

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
community guidelines