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?
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
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).
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.
Copy link to clipboard
Copied
@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.
It is followings. 4 items are new to me. I'll need to check more details.
Thank you very much.