Reply To: Delete all kinds of empty frames anchored within a table!!

#85383

Hi Masood,

please try the following:

var curDoc = app.documents[0];
var allFrames = curDoc.allPageItems;

for (var i = allFrames.length-1; i >= 0; i--) {
  var curFrame = allFrames[i];
  var curType = curFrame.constructor.name;
	var wrap = curFrame.textWrapPreferences.textWrapMode;
  if (curType == "TextFrame" && curFrame.contents == "" && wrap == TextWrapModes.NONE) {
      curFrame.remove();
  }
  else if (curType == "Rectangle" || curType == "Polygon" || curType == "Oval") {
    if (!curFrame.graphics.length) {
      if (curFrame.fillColor.name == "None" && curFrame.strokeColor.name == "None" && wrap == TextWrapModes.NONE) {
        curFrame.remove();
      }
    }
  }
}

best
Kai

This article was last modified on June 2, 2016

Comments (0)

Loading comments...