• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[Q] Object types for activeDocument.selection

Contributor ,
May 03, 2017 May 03, 2017

Copy link to clipboard

Copied

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.typename);

    }

}else{ // No selection

    $.writeln("No selection");

}

Thank you very much

TOPICS
Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 05, 2017 May 05, 2017

Copy link to clipboard

Copied

Check out the scripting reference for your particular version of illustrator. I'm apparently behind a firewall that won't let me get to the page that has the reference guides for every illustrator version, but here's a copy for CC2014 (the DOM is pretty consistent across all versions).

http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2014/Illustrator%20Scriptin...

check page 35 for all of the document properties.

Another option is to check the OMV (object model viewer) inside ExtendScript Toolkit. It's under the help menu, and you can search for any objects you want and see all of the available properties and methods.

Hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 05, 2017 May 05, 2017

Copy link to clipboard

Copied

LATEST

@williamadowling Thank you very much for the info.

I verified the OMV  that items of selection array is all subclass of PageItem.

PageItems is explained at page 118 of CC2017 version of JavaScript reference.

   http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2017/Illustrator_JavaScript...

It is followings. 4 items are new to me. I'll need to check more details.

  • CompoundPathItem (new to me)
  • GraphItem
  • GroupItem
  • LegacyTextItem (new to me)
  • MeshItem
  • NonNativeItem (new to me)
  • PathItem
  • PlacedItem
  • PluginItem (new to me)
  • RasterItem
  • SymbolItem
  • TextFrameItem (typename == TextFrame)

Thank you very much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines