Answered
HI @dublove ,
all your text frames ( other page items as well ) have a unique ID value.
So you could determine all the text frames' id values of a given story and compare the id value of the one of your selection to a specific one of the text frames of a story:
var selectedTextFrame = app.selection[0] ;
var idOfSelectedTextFrame = selectedTextFrame.id ;
var parentStory = selectedTextFrame.parentStory ;
var allTextContainersArray = parentStory.textContainers ;
for( var n=0; n < allTextContainersArray.length; n++ )
{
if( allTextContainersArray[n].id == idOfSelectedTextFrame )
{
alert( "Selected frame found. Frame "+ (n+1) + " in the story is selected." );
break;
}
};
Or you could directly compare the text frames of the story to the one that is selected.
If you do this with the array of textContainers you first have to resolve the textContainer you like to compare with getElements() like below :
var selectedTextFrame = app.selection[0] ;
var parentStory = selectedTextFrame.parentStory ;
var allTextContainersArray = parentStory.textContainers ;
for( var n=0; n < allTextContainersArray.length; n++ )
{
if( allTextContainersArray[n].getElements()[0] == selectedTextFrame )
{
alert( "Frame "+ (n+1) + " in the story is selected." );
break;
}
};
Regards,
Uwe Laubender
( Adobe Community Expert )
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

