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 )

