How to determine if the current selection is an object? Not just the cursor being inside a text box.
I need to identify the current cursor state:
case A: Object selected (including: text frames, images, geometric shapes).
case B: Cursor inside a text box (including: within text, within a table).
Currently, I'm using `items.length >= 1` to determine this.
Like this:
var doc = app.activeDocument;
var item = doc.selection[0];
var items = doc.selection;
if (items.length >= 1) {
alert(items.length);
}But this feels unscientific.
I suspect `items.length` also equals 1 when the cursor is in a text box.
Does this mean I need to exclude text boxes too:
(! item.hasOwnProperty(‘parentTextFrames’) && “Table” != item.parent.parent.constructor.name)This gets complicated and feels unscientific.
Translated with DeepL.com (free version)
