Site logo

Object hierarchy

Function 'genealogy'

Get the nested hierarchy of the selected object

var myData = new Array;
if (app.selection.length > 0)
{
     var myObject = app.selection[0];
     myData.push(myObject.constructor.name);
     do
     {
          myObject = myObject.parent;
          myData.push(myObject.constructor.name)
     } while (myObject.constructor.name != 'Application')
     alert('Genealogy\r' + myData.join('\r'));
}