2 Replies Latest reply on May 5, 2017 8:20 AM by Naoki-Hada

    [Q] Object types for activeDocument.selection

    Naoki-Hada Level 1

      Hi all,

       

      I'm trying to get all object types of activeDocument.selection.

      At current point, I got following list with below code.

       

      Is there more object types might be in activeDocument.selection?

      Is app.selection same as activeDocument.selection always?

       

      • TextRange: Text String in Text Object is selected
      • TextFrame: Text Object is selected
      • PathItem: Regular object is selected
      • GroupItem: Grouped objects are selected
      • GraphItem: By Graph Tool
      • MeshItem: By Mesh Tool
      • PlacedItem: Drag and dropped image (JPG etc)
      • RasterItem: Menu: Object=>Rasterize
      • SymboleItem: From Symbols Pallet

       

       

      List of selected object types

      var _sel = activeDocument.selection;

       

      if("TextRange" == _sel.typename){ // Text String in Text Object is selected

          $.writeln("TextRange is selected");

          $.writeln("_sel.length = ", _sel.length);

       

       

      }else if(0 != _sel.length){ // Array: Single and Multiple items case

          $.writeln("Number of selection = ", _sel.length);

          for(var i=0; i<_sel.length; i++){ // debug display

              $.writeln("selection[" + i + "] = (typename)" + _sel[i].typename);

          }

       

       

      }else{ // No selection

          $.writeln("No selection");

      }

       

      Thank you very much