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!
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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