Argh, Jarek was quicker than me ;-)
I’m not sure, if this is a good solution, but for me this one works too:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll; if ( !(app.selection.length == 1 && app.selection[0].constructor.name == "TextFrame" ) ) { alert( "Check your selection!" ); exit(); } else { var curSel = app.selection[0]; } var firstChar = curSel.characters[0]; if ( firstChar.textFrames.length == 1 || firstChar.tables.length == 1 ) { alert( "true" ); } else { alert( "false" ); }