Hi,
Are you considering a table placed in your textFrame with no container (your textFrame is a table.parent)?
Are you considering a spaces or empty lines in the beginnig of your textFrame?
You could detect objects at the beginning of a frame by checking
mTextFrame.texts[0].characters[0].pageItems.length // 0 means false
However considering my two question a function could look like:
function objectSearcher (depth) { var mFrame = app.selection[0]; if (!mFrame || mFrame.constructor.name != "TextFrame" ) return false; // if depth no specified - whole textFrame is a target if (isNaN (depth) ) depth = -1; var mText = mFrame.texts[0].characters.itemByRange(0,depth).texts[0], mItems = mText.pageItems, mTables = mText.tables, // in case of table is placed with no additional container itemsCount = mItems.length, tablesCount = mTables.length; if (itemsCount || tablesCount) return true; else return false; } mResult = objectSearcher ();
depth = 0 to check 1st character only
depth = null to check entire textFrame
Jarek