Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 150094

Re: Re: Check the first object within text frame if another text frame or normal text with JaveScript

$
0
0

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" );
}

Viewing all articles
Browse latest Browse all 150094

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>