Skip to content
fabiantheblind edited this page Aug 16, 2013 · 7 revisions

This was written for this stackoverflow question.

  // this script needs:
  // - a document with one page
  // - some groups with textframes in it on the first page
  var pg = app.activeDocument.pages[0]; // get the first page of the current doc
  var groups = pg.groups; // get all groups
  var tf_ingroup_counter = 0; // init a counter for all textframes in groups
  for(var g = 0; g < groups.length;g++){
      var grp = groups[g];
          for(var t = 0; t < grp.textFrames.length;t++){
              var tf = grp.textFrames[t]; // get the
                  if(tf instanceof TextFrame){
                      tf_ingroup_counter++; // increment counter
                      } // end loop textfraems in group
          }
      } // end loop groups
// alert all you have found
  alert(
    "I found on page " + pg.name +"\n" + pg.textFrames.length +
    " textframes\nOh and there are also " +
    tf_ingroup_counter+ " hidden in groups"
  );
Clone this wiki locally